From owner-svn-soc-all@FreeBSD.ORG Sat Jul 6 16:11:11 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6939DA5C for ; Sat, 6 Jul 2013 16:11:11 +0000 (UTC) (envelope-from dpl@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) by mx1.freebsd.org (Postfix) with ESMTP id 4A7A81BED for ; Sat, 6 Jul 2013 16:11:11 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r66GBAkX074943 for ; Sat, 6 Jul 2013 16:11:10 GMT (envelope-from dpl@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r66GBAu4074921 for svn-soc-all@FreeBSD.org; Sat, 6 Jul 2013 16:11:10 GMT (envelope-from dpl@FreeBSD.org) Date: Sat, 6 Jul 2013 16:11:10 GMT Message-Id: <201307061611.r66GBAu4074921@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to dpl@FreeBSD.org using -f From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r254245 - soc2013/dpl/head/contrib/bzip2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jul 2013 16:11:11 -0000 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 # include -# 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",