socsvn commit: r254245 - soc2013/dpl/head/contrib/bzip2
dpl at FreeBSD.org
dpl at FreeBSD.org
Sat Jul 6 16:11:11 UTC 2013
Author: dpl
Date: Sat Jul 6 16:11:10 2013
New Revision: 254245
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=254245
Log:
Everything is adapted, but I get SIGSEGV. Searching for the cause.
Modified:
soc2013/dpl/head/contrib/bzip2/bzip2.c
Modified: soc2013/dpl/head/contrib/bzip2/bzip2.c
==============================================================================
--- soc2013/dpl/head/contrib/bzip2/bzip2.c Sat Jul 6 14:21:22 2013 (r254244)
+++ soc2013/dpl/head/contrib/bzip2/bzip2.c Sat Jul 6 16:11:10 2013 (r254245)
@@ -114,6 +114,7 @@
# undef MY_STAT
# define MY_LSTAT stat
# define MY_STAT stat
+# define MY_STATS stat
# undef SET_BINARY_MODE
# define SET_BINARY_MODE(fd) \
do { \
@@ -143,10 +144,11 @@
# include <fcntl.h>
# include <sys\stat.h>
-# define NORETURN /**/
-# define PATH_SEP '\\'
-# define MY_LSTAT _stat
+# define NORETURN /**/
+# define PATH_SEP '\\'
+# define MY_LSTAT _stat
# define MY_STAT _stat
+# define MY_STATS _stat
# define MY_S_ISREG(x) ((x) & _S_IFREG)
# define MY_S_ISDIR(x) ((x) & _S_IFDIR)
@@ -741,7 +743,7 @@
January 2002. (JRS 06-Jan-2002: other changes in 1.0.2 mean
this is less likely to happen. But to be ultra-paranoid, we
do the check anyway.) */
- retVal = MY_STAT ( inName, &statBuf );
+ retVal = MY_STAT ( IN_FILENO, inName, &statBuf, 0 );
if (retVal == 0) {
if (noisy)
fprintf ( stderr,
@@ -1021,12 +1023,12 @@
if in doubt, return True
--*/
static
-Bool notAStandardFile (int fd )
+Bool notAStandardFile (int fd, Char* name )
{
IntNative i;
struct MY_STATS statBuf;
- i = MY_LSTAT ( fd, &statBuf );
+ i = MY_LSTAT ( fd, name, &statBuf, AT_SYMLINK_NOFOLLOW );
if (i != 0) return True;
if (MY_S_ISREG(statBuf.st_mode)) return False;
return True;
@@ -1038,12 +1040,12 @@
rac 11/21/98 see if file has hard links to it
--*/
static
-Int32 countHardLinks ( int fd )
+Int32 countHardLinks ( int fd, Char* name )
{
IntNative i;
- struct MY_STAT statBuf;
+ struct MY_STATS statBuf;
- i = MY_LSTAT ( fd, &statBuf );
+ i = MY_LSTAT ( fd, name, &statBuf, AT_SYMLINK_NOFOLLOW );
if (i != 0) return 0;
return (statBuf.st_nlink - 1);
}
@@ -1074,16 +1076,16 @@
*/
#if BZ_UNIX
static
-struct MY_STAT fileMetaInfo;
+struct MY_STATS fileMetaInfo;
#endif
static
-void saveInputFileMetaInfo ( Char *srcName )
+void saveInputFileMetaInfo ( int fd, Char *srcName )
{
# if BZ_UNIX
IntNative retVal;
/* Note use of stat here, not lstat. */
- retVal = MY_STAT( srcName, &fileMetaInfo );
+ retVal = MY_STAT( fd, srcName, &fileMetaInfo, 0 );
ERROR_IF_NOT_ZERO ( retVal );
# endif
}
@@ -1183,7 +1185,7 @@
pid_t forkpid;
#endif
Int32 n, i;
- struct MY_STAT statBuf;
+ struct MY_STATS statBuf;
deleteOutputOnInterrupt = False;
@@ -1230,7 +1232,7 @@
}
}
if ( srcMode == SM_F2F || srcMode == SM_F2O ) {
- MY_STAT(inName, &statBuf);
+ MY_STAT( IN_FILENO, inName, &statBuf, 0);
if ( MY_S_ISDIR(statBuf.st_mode) ) {
fprintf( stderr,
"%s: Input file %s is a directory.\n",
@@ -1239,7 +1241,7 @@
return;
}
}
- if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( IN_FILENO )) {
+ if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName, IN_FILENO )) {
if (noisy)
fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
progName, inName );
@@ -1257,7 +1259,7 @@
}
}
if ( srcMode == SM_F2F && !forceOverwrite &&
- (n=countHardLinks ( IN_FILENO )) > 0) {
+ (n=countHardLinks ( IN_FILENO, inName )) > 0) {
fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
progName, inName, n, n > 1 ? "s" : "" );
setExit(1);
@@ -1267,7 +1269,7 @@
if ( srcMode == SM_F2F ) {
/* Save the file's meta-info before we open it. Doing it later
means we mess up the access times. */
- saveInputFileMetaInfo ( inName );
+ saveInputFileMetaInfo ( IN_FILENO, inName );
}
switch ( srcMode ) {
@@ -1348,7 +1350,7 @@
wait(NULL);
return;
} else if (forkpid == 0){
- limitfd(IN_FILENO));
+ limitfd(IN_FILENO);
limitfd(OUT_FILENO);
limitfd(STDERR_FILENO);
if (cap_enter() < 0 && errno != ENOSYS){
@@ -1395,7 +1397,7 @@
Int32 n, i;
Bool magicNumberOK;
Bool cantGuess;
- struct MY_STAT statBuf;
+ struct MY_STATS statBuf;
deleteOutputOnInterrupt = False;
@@ -1438,7 +1440,7 @@
return;
}
if ( srcMode == SM_F2F || srcMode == SM_F2O ) {
- MY_STAT(inName, &statBuf);
+ MY_STAT(IN_FILENO, inName, &statBuf, 0);
if ( MY_S_ISDIR(statBuf.st_mode) ) {
fprintf( stderr,
"%s: Input file %s is a directory.\n",
@@ -1447,7 +1449,7 @@
return;
}
}
- if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( IN_FILENO )) {
+ if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName, IN_FILENO )) {
if (noisy)
fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
progName, inName );
@@ -1472,7 +1474,7 @@
}
}
if ( srcMode == SM_F2F && !forceOverwrite &&
- (n=countHardLinks ( IN_FILENO ) ) > 0) {
+ (n=countHardLinks ( IN_FILENO, inName ) ) > 0) {
fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
progName, inName, n, n > 1 ? "s" : "" );
setExit(1);
@@ -1482,7 +1484,7 @@
if ( srcMode == SM_F2F ) {
/* Save the file's meta-info before we open it. Doing it later
means we mess up the access times. */
- saveInputFileMetaInfo ( inName );
+ saveInputFileMetaInfo ( IN_FILENO, inName );
}
switch ( srcMode ) {
@@ -1616,7 +1618,7 @@
{
FILE *inStr;
Bool allOK;
- struct MY_STAT statBuf;
+ struct MY_STATS statBuf;
deleteOutputOnInterrupt = False;
@@ -1644,7 +1646,7 @@
return;
}
if ( srcMode != SM_I2O ) {
- MY_STAT(inName, &statBuf);
+ MY_STAT(inName, IN_FILENO, &statBuf, 0);
if ( MY_S_ISDIR(statBuf.st_mode) ) {
fprintf( stderr,
"%s: Input file %s is a directory.\n",
More information about the svn-soc-all
mailing list