Always report the applet name when doing error reporting.
This commit is contained in:
parent
e58771e73c
commit
be84cd4ef6
6
ar.c
6
ar.c
@ -158,12 +158,12 @@ static int copySubFile(int srcFd, int dstFd, int copySize)
|
|||||||
readSize = copySize;
|
readSize = copySize;
|
||||||
writeSize = fullRead(srcFd, buffer, readSize);
|
writeSize = fullRead(srcFd, buffer, readSize);
|
||||||
if (writeSize <= 0) {
|
if (writeSize <= 0) {
|
||||||
errorMsg(io_error, "copySubFile :", strerror(errno));
|
errorMsg(io_error, "copySubFile", strerror(errno));
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
doneSize = fullWrite(dstFd, buffer, writeSize);
|
doneSize = fullWrite(dstFd, buffer, writeSize);
|
||||||
if (doneSize <= 0) {
|
if (doneSize <= 0) {
|
||||||
errorMsg(io_error, "copySubFile :", strerror(errno));
|
errorMsg(io_error, "copySubFile", strerror(errno));
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
copySize -= doneSize;
|
copySize -= doneSize;
|
||||||
@ -220,7 +220,7 @@ static int getArFd(char *filename)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
if (fullRead(arFd, arVersion, 8) <= 0) {
|
if (fullRead(arFd, arVersion, 8) <= 0) {
|
||||||
errorMsg( "ar: Unexpected EOF in archive\n");
|
errorMsg( "Unexpected EOF in archive\n");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
if (strncmp(arVersion,"!<arch>",7) != 0) {
|
if (strncmp(arVersion,"!<arch>",7) != 0) {
|
||||||
|
@ -158,12 +158,12 @@ static int copySubFile(int srcFd, int dstFd, int copySize)
|
|||||||
readSize = copySize;
|
readSize = copySize;
|
||||||
writeSize = fullRead(srcFd, buffer, readSize);
|
writeSize = fullRead(srcFd, buffer, readSize);
|
||||||
if (writeSize <= 0) {
|
if (writeSize <= 0) {
|
||||||
errorMsg(io_error, "copySubFile :", strerror(errno));
|
errorMsg(io_error, "copySubFile", strerror(errno));
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
doneSize = fullWrite(dstFd, buffer, writeSize);
|
doneSize = fullWrite(dstFd, buffer, writeSize);
|
||||||
if (doneSize <= 0) {
|
if (doneSize <= 0) {
|
||||||
errorMsg(io_error, "copySubFile :", strerror(errno));
|
errorMsg(io_error, "copySubFile", strerror(errno));
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
copySize -= doneSize;
|
copySize -= doneSize;
|
||||||
@ -220,7 +220,7 @@ static int getArFd(char *filename)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
if (fullRead(arFd, arVersion, 8) <= 0) {
|
if (fullRead(arFd, arVersion, 8) <= 0) {
|
||||||
errorMsg( "ar: Unexpected EOF in archive\n");
|
errorMsg( "Unexpected EOF in archive\n");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
if (strncmp(arVersion,"!<arch>",7) != 0) {
|
if (strncmp(arVersion,"!<arch>",7) != 0) {
|
||||||
|
@ -212,7 +212,7 @@ extern int method; /* compression method */
|
|||||||
# define DECLARE(type, array, size) type * array
|
# define DECLARE(type, array, size) type * array
|
||||||
# define ALLOC(type, array, size) { \
|
# define ALLOC(type, array, size) { \
|
||||||
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
||||||
if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \
|
if (array == NULL) errorMsg(memory_exhausted); \
|
||||||
}
|
}
|
||||||
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
||||||
#else
|
#else
|
||||||
@ -930,7 +930,7 @@ int in, out; /* input and output file descriptors */
|
|||||||
int res = inflate();
|
int res = inflate();
|
||||||
|
|
||||||
if (res == 3) {
|
if (res == 3) {
|
||||||
errorMsg(memory_exhausted, "gunzip");
|
errorMsg(memory_exhausted);
|
||||||
} else if (res != 0) {
|
} else if (res != 0) {
|
||||||
errorMsg("invalid compressed data--format violated");
|
errorMsg("invalid compressed data--format violated");
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ extern int method; /* compression method */
|
|||||||
# define DECLARE(type, array, size) type * array
|
# define DECLARE(type, array, size) type * array
|
||||||
# define ALLOC(type, array, size) { \
|
# define ALLOC(type, array, size) { \
|
||||||
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
||||||
if (array == NULL) errorMsg(memory_exhausted, "gzip"); \
|
if (array == NULL) errorMsg(memory_exhausted); \
|
||||||
}
|
}
|
||||||
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
||||||
#else
|
#else
|
||||||
@ -3251,7 +3251,7 @@ char *env; /* name of environment variable */
|
|||||||
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
|
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
|
||||||
|
|
||||||
if (nargv == NULL)
|
if (nargv == NULL)
|
||||||
errorMsg(memory_exhausted, "gzip");
|
errorMsg(memory_exhausted);
|
||||||
oargv = *argvp;
|
oargv = *argvp;
|
||||||
*argvp = nargv;
|
*argvp = nargv;
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
}
|
}
|
||||||
if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
|
if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
|
||||||
/* Tarball seems to have a problem */
|
/* Tarball seems to have a problem */
|
||||||
errorMsg("tar: Unexpected EOF in archive\n");
|
errorMsg("Unexpected EOF in archive\n");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
if ( readSize < writeSize )
|
if ( readSize < writeSize )
|
||||||
@ -368,7 +368,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
return( TRUE);
|
return( TRUE);
|
||||||
|
|
||||||
if (createPath(header->name, header->mode) != TRUE) {
|
if (createPath(header->name, header->mode) != TRUE) {
|
||||||
errorMsg("tar: %s: Cannot mkdir: %s\n",
|
errorMsg("%s: Cannot mkdir: %s\n",
|
||||||
header->name, strerror(errno));
|
header->name, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
return( TRUE);
|
return( TRUE);
|
||||||
|
|
||||||
if (link(header->linkname, header->name) < 0) {
|
if (link(header->linkname, header->name) < 0) {
|
||||||
errorMsg("tar: %s: Cannot create hard link to '%s': %s\n",
|
errorMsg("%s: Cannot create hard link to '%s': %s\n",
|
||||||
header->name, header->linkname, strerror(errno));
|
header->name, header->linkname, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
|
|
||||||
#ifdef S_ISLNK
|
#ifdef S_ISLNK
|
||||||
if (symlink(header->linkname, header->name) < 0) {
|
if (symlink(header->linkname, header->name) < 0) {
|
||||||
errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
|
errorMsg("%s: Cannot create symlink to '%s': %s\n",
|
||||||
header->name, header->linkname, strerror(errno));
|
header->name, header->linkname, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
/* Do not change permissions or date on symlink,
|
/* Do not change permissions or date on symlink,
|
||||||
* since it changes the pointed to file instead. duh. */
|
* since it changes the pointed to file instead. duh. */
|
||||||
#else
|
#else
|
||||||
errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
|
errorMsg("%s: Cannot create symlink to '%s': %s\n",
|
||||||
header->name, header->linkname,
|
header->name, header->linkname,
|
||||||
"symlinks not supported");
|
"symlinks not supported");
|
||||||
#endif
|
#endif
|
||||||
@ -436,13 +436,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
|
|
||||||
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
|
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
|
||||||
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
|
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
|
||||||
errorMsg("tar: %s: Cannot mknod: %s\n",
|
errorMsg("%s: Cannot mknod: %s\n",
|
||||||
header->name, strerror(errno));
|
header->name, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
} else if (S_ISFIFO(header->mode)) {
|
} else if (S_ISFIFO(header->mode)) {
|
||||||
if (mkfifo(header->name, header->mode) < 0) {
|
if (mkfifo(header->name, header->mode) < 0) {
|
||||||
errorMsg("tar: %s: Cannot mkfifo: %s\n",
|
errorMsg("%s: Cannot mkfifo: %s\n",
|
||||||
header->name, strerror(errno));
|
header->name, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header)
|
|||||||
++*(header->name);
|
++*(header->name);
|
||||||
|
|
||||||
if (alreadyWarned == FALSE) {
|
if (alreadyWarned == FALSE) {
|
||||||
errorMsg("tar: Removing leading '/' from member names\n");
|
errorMsg("Removing leading '/' from member names\n");
|
||||||
alreadyWarned = TRUE;
|
alreadyWarned = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -695,7 +695,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
else if (errorFlag==TRUE) {
|
else if (errorFlag==TRUE) {
|
||||||
errorMsg( "tar: Error exit delayed from previous errors\n");
|
errorMsg( "Error exit delayed from previous errors\n");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
} else
|
} else
|
||||||
return( status);
|
return( status);
|
||||||
@ -705,7 +705,7 @@ endgame:
|
|||||||
close( tarFd);
|
close( tarFd);
|
||||||
if ( *(header.name) == '\0' ) {
|
if ( *(header.name) == '\0' ) {
|
||||||
if (errorFlag==TRUE)
|
if (errorFlag==TRUE)
|
||||||
errorMsg( "tar: Error exit delayed from previous errors\n");
|
errorMsg( "Error exit delayed from previous errors\n");
|
||||||
else
|
else
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
|
|||||||
if (*fileName=='/') {
|
if (*fileName=='/') {
|
||||||
static int alreadyWarned=FALSE;
|
static int alreadyWarned=FALSE;
|
||||||
if (alreadyWarned==FALSE) {
|
if (alreadyWarned==FALSE) {
|
||||||
errorMsg("tar: Removing leading '/' from member names\n");
|
errorMsg("Removing leading '/' from member names\n");
|
||||||
alreadyWarned=TRUE;
|
alreadyWarned=TRUE;
|
||||||
}
|
}
|
||||||
strncpy(header.name, fileName+1, sizeof(header.name));
|
strncpy(header.name, fileName+1, sizeof(header.name));
|
||||||
@ -854,7 +854,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
|
|||||||
header.typeflag = REGTYPE;
|
header.typeflag = REGTYPE;
|
||||||
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
||||||
} else {
|
} else {
|
||||||
errorMsg("tar: %s: Unknown file type\n", fileName);
|
errorMsg("%s: Unknown file type\n", fileName);
|
||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,7 +892,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
|
|
||||||
/* It is against the rules to archive a socket */
|
/* It is against the rules to archive a socket */
|
||||||
if (S_ISSOCK(statbuf->st_mode)) {
|
if (S_ISSOCK(statbuf->st_mode)) {
|
||||||
errorMsg("tar: %s: socket ignored\n", fileName);
|
errorMsg("%s: socket ignored\n", fileName);
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,7 +901,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
* the new tarball */
|
* the new tarball */
|
||||||
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
||||||
tbInfo->statBuf.st_ino == statbuf->st_ino) {
|
tbInfo->statBuf.st_ino == statbuf->st_ino) {
|
||||||
errorMsg("tar: %s: file is the archive; skipping\n", fileName);
|
errorMsg("%s: file is the archive; skipping\n", fileName);
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,7 +917,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
|
|
||||||
/* open the file we want to archive, and make sure all is well */
|
/* open the file we want to archive, and make sure all is well */
|
||||||
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
|
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
|
||||||
errorMsg("tar: %s: Cannot open: %s\n", fileName, strerror(errno));
|
errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,7 +955,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag,
|
|||||||
|
|
||||||
/* Make sure there is at least one file to tar up. */
|
/* Make sure there is at least one file to tar up. */
|
||||||
if (argc <= 0)
|
if (argc <= 0)
|
||||||
fatalError("tar: Cowardly refusing to create an empty archive\n");
|
fatalError("Cowardly refusing to create an empty archive\n");
|
||||||
|
|
||||||
/* Open the tar file for writing. */
|
/* Open the tar file for writing. */
|
||||||
if (tostdoutFlag == TRUE)
|
if (tostdoutFlag == TRUE)
|
||||||
@ -963,7 +963,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag,
|
|||||||
else
|
else
|
||||||
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
if (tbInfo.tarFd < 0) {
|
if (tbInfo.tarFd < 0) {
|
||||||
errorMsg( "tar: Error opening '%s': %s\n", tarName, strerror(errno));
|
errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
|
||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
tbInfo.excludeList=excludeList;
|
tbInfo.excludeList=excludeList;
|
||||||
@ -997,7 +997,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag,
|
|||||||
/* Hang up the tools, close up shop, head home */
|
/* Hang up the tools, close up shop, head home */
|
||||||
close(tarFd);
|
close(tarFd);
|
||||||
if (errorFlag == TRUE) {
|
if (errorFlag == TRUE) {
|
||||||
errorMsg("tar: Error exit delayed from previous errors\n");
|
errorMsg("Error exit delayed from previous errors\n");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
|
@ -87,7 +87,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
|||||||
case CHMOD_APP:
|
case CHMOD_APP:
|
||||||
/* Parse the specified modes */
|
/* Parse the specified modes */
|
||||||
if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) {
|
if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) {
|
||||||
fatalError( "%s: unknown mode: %s\n", applet_name, theMode);
|
fatalError( "unknown mode: %s\n", theMode);
|
||||||
}
|
}
|
||||||
if (chmod(fileName, statbuf->st_mode) == 0)
|
if (chmod(fileName, statbuf->st_mode) == 0)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -169,15 +169,14 @@ int chmod_chown_chgrp_main(int argc, char **argv)
|
|||||||
if (*argv == p)
|
if (*argv == p)
|
||||||
uid = my_getpwnam(*argv);
|
uid = my_getpwnam(*argv);
|
||||||
if (uid == -1) {
|
if (uid == -1) {
|
||||||
fatalError( "%s: unknown user name: %s\n",
|
fatalError( "unknown user name: %s\n", *argv);
|
||||||
applet_name, *argv);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ok, ready to do the deed now */
|
/* Ok, ready to do the deed now */
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
fatalError( "%s: too few arguments\n", applet_name);
|
fatalError( "too few arguments\n");
|
||||||
}
|
}
|
||||||
while (argc-- > 1) {
|
while (argc-- > 1) {
|
||||||
if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE,
|
if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE,
|
||||||
@ -187,7 +186,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
|
|||||||
exit(TRUE);
|
exit(TRUE);
|
||||||
|
|
||||||
bad_group:
|
bad_group:
|
||||||
fatalError( "%s: unknown group name: %s\n", applet_name, groupName);
|
fatalError( "unknown group name: %s\n", groupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
6
chroot.c
6
chroot.c
@ -47,8 +47,7 @@ int chroot_main(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
if (chroot(*argv) || (chdir("/"))) {
|
if (chroot(*argv) || (chdir("/"))) {
|
||||||
fatalError("chroot: cannot change root directory to %s: %s\n",
|
fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
|
||||||
*argv, strerror(errno));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
@ -62,8 +61,7 @@ int chroot_main(int argc, char **argv)
|
|||||||
prog = "/bin/sh";
|
prog = "/bin/sh";
|
||||||
execlp(prog, prog, NULL);
|
execlp(prog, prog, NULL);
|
||||||
}
|
}
|
||||||
fatalError("chroot: cannot execute %s: %s\n",
|
fatalError("cannot execute %s: %s\n", prog, strerror(errno));
|
||||||
prog, strerror(errno));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +47,7 @@ int chroot_main(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
if (chroot(*argv) || (chdir("/"))) {
|
if (chroot(*argv) || (chdir("/"))) {
|
||||||
fatalError("chroot: cannot change root directory to %s: %s\n",
|
fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
|
||||||
*argv, strerror(errno));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
@ -62,8 +61,7 @@ int chroot_main(int argc, char **argv)
|
|||||||
prog = "/bin/sh";
|
prog = "/bin/sh";
|
||||||
execlp(prog, prog, NULL);
|
execlp(prog, prog, NULL);
|
||||||
}
|
}
|
||||||
fatalError("chroot: cannot execute %s: %s\n",
|
fatalError("cannot execute %s: %s\n", prog, strerror(errno));
|
||||||
prog, strerror(errno));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
|||||||
&(tm_time->tm_min), &(tm_time->tm_year));
|
&(tm_time->tm_min), &(tm_time->tm_year));
|
||||||
|
|
||||||
if (nr < 4 || nr > 5) {
|
if (nr < 4 || nr > 5) {
|
||||||
fatalError(invalid_date, "date", t_string);
|
fatalError(invalid_date, t_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* correct for century - minor Y2K problem here? */
|
/* correct for century - minor Y2K problem here? */
|
||||||
@ -150,7 +150,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fatalError(invalid_date, "date", t_string);
|
fatalError(invalid_date, t_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ int date_main(int argc, char **argv)
|
|||||||
case 'u':
|
case 'u':
|
||||||
utc = 1;
|
utc = 1;
|
||||||
if (putenv("TZ=UTC0") != 0)
|
if (putenv("TZ=UTC0") != 0)
|
||||||
fatalError(memory_exhausted, "date");
|
fatalError(memory_exhausted);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
use_arg = 1;
|
use_arg = 1;
|
||||||
@ -236,12 +236,12 @@ int date_main(int argc, char **argv)
|
|||||||
/* Correct any day of week and day of year etc fields */
|
/* Correct any day of week and day of year etc fields */
|
||||||
tm = mktime(&tm_time);
|
tm = mktime(&tm_time);
|
||||||
if (tm < 0)
|
if (tm < 0)
|
||||||
fatalError(invalid_date, "date", date_str);
|
fatalError(invalid_date, date_str);
|
||||||
|
|
||||||
/* if setting time, set it */
|
/* if setting time, set it */
|
||||||
if (set_time) {
|
if (set_time) {
|
||||||
if (stime(&tm) < 0) {
|
if (stime(&tm) < 0) {
|
||||||
fatalError("date: can't set date.\n");
|
fatalError("can't set date.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -708,13 +708,13 @@ static int md5_file(const char *filename,
|
|||||||
} else {
|
} else {
|
||||||
fp = fopen(filename, OPENOPTS(binary));
|
fp = fopen(filename, OPENOPTS(binary));
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md5_stream(fp, md5_result)) {
|
if (md5_stream(fp, md5_result)) {
|
||||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||||
|
|
||||||
if (fp != stdin)
|
if (fp != stdin)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -722,7 +722,7 @@ static int md5_file(const char *filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fp != stdin && fclose(fp) == EOF) {
|
if (fp != stdin && fclose(fp) == EOF) {
|
||||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,7 +746,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
} else {
|
} else {
|
||||||
checkfile_stream = fopen(checkfile_name, "r");
|
checkfile_stream = fopen(checkfile_name, "r");
|
||||||
if (checkfile_stream == NULL) {
|
if (checkfile_stream == NULL) {
|
||||||
errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
|
errorMsg("%s: %s\n", checkfile_name, strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv)
|
|||||||
char buf[BUFSIZ + 1];
|
char buf[BUFSIZ + 1];
|
||||||
|
|
||||||
if (getcwd(buf, sizeof(buf)) == NULL)
|
if (getcwd(buf, sizeof(buf)) == NULL)
|
||||||
fatalError("pwd: %s\n", strerror(errno));
|
fatalError("%s\n", strerror(errno));
|
||||||
|
|
||||||
printf("%s\n", buf);
|
printf("%s\n", buf);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
@ -70,12 +70,12 @@ extern int touch_main(int argc, char **argv)
|
|||||||
if (create == FALSE && errno == ENOENT)
|
if (create == FALSE && errno == ENOENT)
|
||||||
exit(TRUE);
|
exit(TRUE);
|
||||||
else {
|
else {
|
||||||
fatalError("touch: %s", strerror(errno));
|
fatalError("%s", strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
if (utime(*argv, NULL)) {
|
if (utime(*argv, NULL)) {
|
||||||
fatalError("touch: %s", strerror(errno));
|
fatalError("%s", strerror(errno));
|
||||||
}
|
}
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
@ -189,7 +189,7 @@ extern int tr_main(int argc, char **argv)
|
|||||||
complement(input);
|
complement(input);
|
||||||
if (argv[index] != NULL) {
|
if (argv[index] != NULL) {
|
||||||
if (*argv[index] == '\0')
|
if (*argv[index] == '\0')
|
||||||
fatalError("tr: STRING2 cannot be empty\n");
|
fatalError("STRING2 cannot be empty\n");
|
||||||
expand(argv[index], output);
|
expand(argv[index], output);
|
||||||
map(input, output);
|
map(input, output);
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ static int decode (const char *inname,
|
|||||||
&& (freopen (outname, "w", stdout) == NULL
|
&& (freopen (outname, "w", stdout) == NULL
|
||||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||||
)) {
|
)) {
|
||||||
errorMsg("uudeoce %s: %s %s\n", outname, inname, strerror(errno)); /* */
|
errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ int uudecode_main (int argc,
|
|||||||
if (decode (argv[optind], outname) != 0)
|
if (decode (argv[optind], outname) != 0)
|
||||||
exit_status = FALSE;
|
exit_status = FALSE;
|
||||||
} else {
|
} else {
|
||||||
errorMsg("uudecode: %s: %s\n", argv[optind], strerror(errno));
|
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||||
exit_status = FALSE;
|
exit_status = FALSE;
|
||||||
}
|
}
|
||||||
optind++;
|
optind++;
|
||||||
|
@ -217,7 +217,7 @@ int uuencode_main (int argc,
|
|||||||
case 2:
|
case 2:
|
||||||
/* Optional first argument is input file. */
|
/* Optional first argument is input file. */
|
||||||
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
||||||
errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno));
|
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||||
exit FALSE;
|
exit FALSE;
|
||||||
}
|
}
|
||||||
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
|
10
date.c
10
date.c
@ -66,7 +66,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
|||||||
&(tm_time->tm_min), &(tm_time->tm_year));
|
&(tm_time->tm_min), &(tm_time->tm_year));
|
||||||
|
|
||||||
if (nr < 4 || nr > 5) {
|
if (nr < 4 || nr > 5) {
|
||||||
fatalError(invalid_date, "date", t_string);
|
fatalError(invalid_date, t_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* correct for century - minor Y2K problem here? */
|
/* correct for century - minor Y2K problem here? */
|
||||||
@ -150,7 +150,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fatalError(invalid_date, "date", t_string);
|
fatalError(invalid_date, t_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ int date_main(int argc, char **argv)
|
|||||||
case 'u':
|
case 'u':
|
||||||
utc = 1;
|
utc = 1;
|
||||||
if (putenv("TZ=UTC0") != 0)
|
if (putenv("TZ=UTC0") != 0)
|
||||||
fatalError(memory_exhausted, "date");
|
fatalError(memory_exhausted);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
use_arg = 1;
|
use_arg = 1;
|
||||||
@ -236,12 +236,12 @@ int date_main(int argc, char **argv)
|
|||||||
/* Correct any day of week and day of year etc fields */
|
/* Correct any day of week and day of year etc fields */
|
||||||
tm = mktime(&tm_time);
|
tm = mktime(&tm_time);
|
||||||
if (tm < 0)
|
if (tm < 0)
|
||||||
fatalError(invalid_date, "date", date_str);
|
fatalError(invalid_date, date_str);
|
||||||
|
|
||||||
/* if setting time, set it */
|
/* if setting time, set it */
|
||||||
if (set_time) {
|
if (set_time) {
|
||||||
if (stime(&tm) < 0) {
|
if (stime(&tm) < 0) {
|
||||||
fatalError("date: can't set date.\n");
|
fatalError("can't set date.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ static int get_address(const char *str, int *line, regex_t **regex)
|
|||||||
else if (my_str[idx] == '/') {
|
else if (my_str[idx] == '/') {
|
||||||
idx = index_of_next_unescaped_slash(idx, my_str);
|
idx = index_of_next_unescaped_slash(idx, my_str);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
fatalError("sed: unterminated match expression\n");
|
fatalError("unterminated match expression\n");
|
||||||
my_str[idx] = '\0';
|
my_str[idx] = '\0';
|
||||||
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
||||||
if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) {
|
if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) {
|
||||||
@ -243,9 +243,9 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
|
|||||||
|
|
||||||
/* last part (mandatory) will be a command */
|
/* last part (mandatory) will be a command */
|
||||||
if (cmdstr[idx] == '\0')
|
if (cmdstr[idx] == '\0')
|
||||||
fatalError("sed: missing command\n");
|
fatalError("missing command\n");
|
||||||
if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */
|
if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */
|
||||||
fatalError("sed: invalid command\n");
|
fatalError("invalid command\n");
|
||||||
sed_cmd->cmd = cmdstr[idx];
|
sed_cmd->cmd = cmdstr[idx];
|
||||||
/* special-case handling for 's' */
|
/* special-case handling for 's' */
|
||||||
if (sed_cmd->cmd == 's') {
|
if (sed_cmd->cmd == 's') {
|
||||||
@ -259,20 +259,20 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
|
|||||||
|
|
||||||
/* verify that we have an 's' followed by a 'slash' */
|
/* verify that we have an 's' followed by a 'slash' */
|
||||||
if (cmdstr[++idx] != '/')
|
if (cmdstr[++idx] != '/')
|
||||||
fatalError("sed: bad format in substitution expression\n");
|
fatalError("bad format in substitution expression\n");
|
||||||
|
|
||||||
/* save the match string */
|
/* save the match string */
|
||||||
oldidx = idx+1;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
fatalError("sed: bad format in substitution expression\n");
|
fatalError("bad format in substitution expression\n");
|
||||||
match = strdup_substr(cmdstr, oldidx, idx);
|
match = strdup_substr(cmdstr, oldidx, idx);
|
||||||
|
|
||||||
/* save the replacement string */
|
/* save the replacement string */
|
||||||
oldidx = idx+1;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
fatalError("sed: bad format in substitution expression\n");
|
fatalError("bad format in substitution expression\n");
|
||||||
sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx);
|
sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx);
|
||||||
|
|
||||||
/* process the flags */
|
/* process the flags */
|
||||||
@ -285,7 +285,7 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
|
|||||||
cflags |= REG_ICASE;
|
cflags |= REG_ICASE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fatalError("sed: bad option in substitution expression\n");
|
fatalError("bad option in substitution expression\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@ freeramdisk_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((f = open(argv[1], O_RDWR)) == -1) {
|
if ((f = open(argv[1], O_RDWR)) == -1) {
|
||||||
fatalError( "freeramdisk: cannot open %s: %s\n", argv[1], strerror(errno));
|
fatalError( "cannot open %s: %s\n", argv[1], strerror(errno));
|
||||||
}
|
}
|
||||||
if (ioctl(f, BLKFLSBUF) < 0) {
|
if (ioctl(f, BLKFLSBUF) < 0) {
|
||||||
fatalError( "freeramdisk: failed ioctl on %s: %s\n", argv[1], strerror(errno));
|
fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
|
||||||
}
|
}
|
||||||
/* Don't bother closing. Exit does
|
/* Don't bother closing. Exit does
|
||||||
* that, so we can save a few bytes */
|
* that, so we can save a few bytes */
|
||||||
|
4
gunzip.c
4
gunzip.c
@ -212,7 +212,7 @@ extern int method; /* compression method */
|
|||||||
# define DECLARE(type, array, size) type * array
|
# define DECLARE(type, array, size) type * array
|
||||||
# define ALLOC(type, array, size) { \
|
# define ALLOC(type, array, size) { \
|
||||||
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
||||||
if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \
|
if (array == NULL) errorMsg(memory_exhausted); \
|
||||||
}
|
}
|
||||||
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
||||||
#else
|
#else
|
||||||
@ -930,7 +930,7 @@ int in, out; /* input and output file descriptors */
|
|||||||
int res = inflate();
|
int res = inflate();
|
||||||
|
|
||||||
if (res == 3) {
|
if (res == 3) {
|
||||||
errorMsg(memory_exhausted, "gunzip");
|
errorMsg(memory_exhausted);
|
||||||
} else if (res != 0) {
|
} else if (res != 0) {
|
||||||
errorMsg("invalid compressed data--format violated");
|
errorMsg("invalid compressed data--format violated");
|
||||||
}
|
}
|
||||||
|
4
gzip.c
4
gzip.c
@ -127,7 +127,7 @@ extern int method; /* compression method */
|
|||||||
# define DECLARE(type, array, size) type * array
|
# define DECLARE(type, array, size) type * array
|
||||||
# define ALLOC(type, array, size) { \
|
# define ALLOC(type, array, size) { \
|
||||||
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
|
||||||
if (array == NULL) errorMsg(memory_exhausted, "gzip"); \
|
if (array == NULL) errorMsg(memory_exhausted); \
|
||||||
}
|
}
|
||||||
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
|
||||||
#else
|
#else
|
||||||
@ -3251,7 +3251,7 @@ char *env; /* name of environment variable */
|
|||||||
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
|
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
|
||||||
|
|
||||||
if (nargv == NULL)
|
if (nargv == NULL)
|
||||||
errorMsg(memory_exhausted, "gzip");
|
errorMsg(memory_exhausted);
|
||||||
oargv = *argvp;
|
oargv = *argvp;
|
||||||
*argvp = nargv;
|
*argvp = nargv;
|
||||||
|
|
||||||
|
10
lash.c
10
lash.c
@ -850,7 +850,7 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
|
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
|
||||||
fatalError("sh: %s: %s\n", newJob.progs[i].argv[0],
|
fatalError("%s: %s\n", newJob.progs[i].argv[0],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,7 +1043,7 @@ int shell_main(int argc, char **argv)
|
|||||||
/* initialize the cwd */
|
/* initialize the cwd */
|
||||||
cwd = (char *) calloc(BUFSIZ, sizeof(char));
|
cwd = (char *) calloc(BUFSIZ, sizeof(char));
|
||||||
if (cwd == 0) {
|
if (cwd == 0) {
|
||||||
fatalError("sh: out of memory\n");
|
fatalError("out of memory\n");
|
||||||
}
|
}
|
||||||
getcwd(cwd, sizeof(char)*BUFSIZ);
|
getcwd(cwd, sizeof(char)*BUFSIZ);
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ int shell_main(int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
|
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
|
||||||
if (local_pending_command == 0) {
|
if (local_pending_command == 0) {
|
||||||
fatalError("sh: out of memory\n");
|
fatalError("out of memory\n");
|
||||||
}
|
}
|
||||||
for(i=2; i<argc; i++)
|
for(i=2; i<argc; i++)
|
||||||
{
|
{
|
||||||
@ -1073,7 +1073,7 @@ int shell_main(int argc, char **argv)
|
|||||||
local_pending_command = realloc(local_pending_command,
|
local_pending_command = realloc(local_pending_command,
|
||||||
strlen(local_pending_command) + strlen(argv[i]));
|
strlen(local_pending_command) + strlen(argv[i]));
|
||||||
if (local_pending_command==NULL)
|
if (local_pending_command==NULL)
|
||||||
fatalError("sh: commands for -c option too long\n");
|
fatalError("commands for -c option too long\n");
|
||||||
}
|
}
|
||||||
strcat(local_pending_command, argv[i]);
|
strcat(local_pending_command, argv[i]);
|
||||||
if ( (i + 1) < argc)
|
if ( (i + 1) < argc)
|
||||||
@ -1088,7 +1088,7 @@ int shell_main(int argc, char **argv)
|
|||||||
else {
|
else {
|
||||||
input = fopen(argv[1], "r");
|
input = fopen(argv[1], "r");
|
||||||
if (!input) {
|
if (!input) {
|
||||||
fatalError("sh: Couldn't open file '%s': %s\n", argv[1],
|
fatalError("Couldn't open file '%s': %s\n", argv[1],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
md5sum.c
8
md5sum.c
@ -708,13 +708,13 @@ static int md5_file(const char *filename,
|
|||||||
} else {
|
} else {
|
||||||
fp = fopen(filename, OPENOPTS(binary));
|
fp = fopen(filename, OPENOPTS(binary));
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md5_stream(fp, md5_result)) {
|
if (md5_stream(fp, md5_result)) {
|
||||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||||
|
|
||||||
if (fp != stdin)
|
if (fp != stdin)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -722,7 +722,7 @@ static int md5_file(const char *filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fp != stdin && fclose(fp) == EOF) {
|
if (fp != stdin && fclose(fp) == EOF) {
|
||||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,7 +746,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
} else {
|
} else {
|
||||||
checkfile_stream = fopen(checkfile_name, "r");
|
checkfile_stream = fopen(checkfile_name, "r");
|
||||||
if (checkfile_stream == NULL) {
|
if (checkfile_stream == NULL) {
|
||||||
errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
|
errorMsg("%s: %s\n", checkfile_name, strerror(errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,10 @@
|
|||||||
BB_DEF_MESSAGE(not_a_directory, "%s: %s: not a directory\n")
|
BB_DEF_MESSAGE(not_a_directory, "%s: %s: not a directory\n")
|
||||||
#endif
|
#endif
|
||||||
#if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN
|
#if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN
|
||||||
BB_DEF_MESSAGE(memory_exhausted, "%s: memory exhausted\n")
|
BB_DEF_MESSAGE(memory_exhausted, "memory exhausted\n")
|
||||||
#endif
|
#endif
|
||||||
#if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN
|
#if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN
|
||||||
BB_DEF_MESSAGE(invalid_date, "%s: invalid date `%s'\n")
|
BB_DEF_MESSAGE(invalid_date, "invalid date `%s'\n")
|
||||||
#endif
|
#endif
|
||||||
#if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN
|
#if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN
|
||||||
BB_DEF_MESSAGE(invalid_option, "%s: invalid option -- %c\n")
|
BB_DEF_MESSAGE(invalid_option, "%s: invalid option -- %c\n")
|
||||||
|
2
mount.c
2
mount.c
@ -193,7 +193,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (errno == EPERM) {
|
if (errno == EPERM) {
|
||||||
fatalError("mount: permission denied. Are you root?\n");
|
fatalError("permission denied. Are you root?\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
2
nc.c
2
nc.c
@ -69,7 +69,7 @@ int nc_main(int argc, char **argv)
|
|||||||
hostinfo = (struct hostent *) gethostbyname(*argv);
|
hostinfo = (struct hostent *) gethostbyname(*argv);
|
||||||
|
|
||||||
if (!hostinfo) {
|
if (!hostinfo) {
|
||||||
fatalError("nc: cannot resolve %s\n", *argv);
|
fatalError("cannot resolve %s\n", *argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
address.sin_family = AF_INET;
|
address.sin_family = AF_INET;
|
||||||
|
@ -69,7 +69,7 @@ int nc_main(int argc, char **argv)
|
|||||||
hostinfo = (struct hostent *) gethostbyname(*argv);
|
hostinfo = (struct hostent *) gethostbyname(*argv);
|
||||||
|
|
||||||
if (!hostinfo) {
|
if (!hostinfo) {
|
||||||
fatalError("nc: cannot resolve %s\n", *argv);
|
fatalError("cannot resolve %s\n", *argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
address.sin_family = AF_INET;
|
address.sin_family = AF_INET;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* vi: set sw=4 ts=4: */
|
||||||
/*
|
/*
|
||||||
* $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $
|
* $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $
|
||||||
* Mini ping implementation for busybox
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -336,7 +336,7 @@ static void sendping(int ign)
|
|||||||
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
fatalError("ping: sendto: %s\n", strerror(errno));
|
fatalError("sendto: %s\n", strerror(errno));
|
||||||
else if (i != sizeof(packet))
|
else if (i != sizeof(packet))
|
||||||
fatalError("ping wrote %d chars; %d expected\n", i,
|
fatalError("ping wrote %d chars; %d expected\n", i,
|
||||||
(int)sizeof(packet));
|
(int)sizeof(packet));
|
||||||
|
4
ping.c
4
ping.c
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* vi: set sw=4 ts=4: */
|
||||||
/*
|
/*
|
||||||
* $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $
|
* $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $
|
||||||
* Mini ping implementation for busybox
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -336,7 +336,7 @@ static void sendping(int ign)
|
|||||||
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
||||||
|
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
fatalError("ping: sendto: %s\n", strerror(errno));
|
fatalError("sendto: %s\n", strerror(errno));
|
||||||
else if (i != sizeof(packet))
|
else if (i != sizeof(packet))
|
||||||
fatalError("ping wrote %d chars; %d expected\n", i,
|
fatalError("ping wrote %d chars; %d expected\n", i,
|
||||||
(int)sizeof(packet));
|
(int)sizeof(packet));
|
||||||
|
2
pwd.c
2
pwd.c
@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv)
|
|||||||
char buf[BUFSIZ + 1];
|
char buf[BUFSIZ + 1];
|
||||||
|
|
||||||
if (getcwd(buf, sizeof(buf)) == NULL)
|
if (getcwd(buf, sizeof(buf)) == NULL)
|
||||||
fatalError("pwd: %s\n", strerror(errno));
|
fatalError("%s\n", strerror(errno));
|
||||||
|
|
||||||
printf("%s\n", buf);
|
printf("%s\n", buf);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
14
sed.c
14
sed.c
@ -196,7 +196,7 @@ static int get_address(const char *str, int *line, regex_t **regex)
|
|||||||
else if (my_str[idx] == '/') {
|
else if (my_str[idx] == '/') {
|
||||||
idx = index_of_next_unescaped_slash(idx, my_str);
|
idx = index_of_next_unescaped_slash(idx, my_str);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
fatalError("sed: unterminated match expression\n");
|
fatalError("unterminated match expression\n");
|
||||||
my_str[idx] = '\0';
|
my_str[idx] = '\0';
|
||||||
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
||||||
if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) {
|
if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) {
|
||||||
@ -243,9 +243,9 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
|
|||||||
|
|
||||||
/* last part (mandatory) will be a command */
|
/* last part (mandatory) will be a command */
|
||||||
if (cmdstr[idx] == '\0')
|
if (cmdstr[idx] == '\0')
|
||||||
fatalError("sed: missing command\n");
|
fatalError("missing command\n");
|
||||||
if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */
|
if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */
|
||||||
fatalError("sed: invalid command\n");
|
fatalError("invalid command\n");
|
||||||
sed_cmd->cmd = cmdstr[idx];
|
sed_cmd->cmd = cmdstr[idx];
|
||||||
/* special-case handling for 's' */
|
/* special-case handling for 's' */
|
||||||
if (sed_cmd->cmd == 's') {
|
if (sed_cmd->cmd == 's') {
|
||||||
@ -259,20 +259,20 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
|
|||||||
|
|
||||||
/* verify that we have an 's' followed by a 'slash' */
|
/* verify that we have an 's' followed by a 'slash' */
|
||||||
if (cmdstr[++idx] != '/')
|
if (cmdstr[++idx] != '/')
|
||||||
fatalError("sed: bad format in substitution expression\n");
|
fatalError("bad format in substitution expression\n");
|
||||||
|
|
||||||
/* save the match string */
|
/* save the match string */
|
||||||
oldidx = idx+1;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
fatalError("sed: bad format in substitution expression\n");
|
fatalError("bad format in substitution expression\n");
|
||||||
match = strdup_substr(cmdstr, oldidx, idx);
|
match = strdup_substr(cmdstr, oldidx, idx);
|
||||||
|
|
||||||
/* save the replacement string */
|
/* save the replacement string */
|
||||||
oldidx = idx+1;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
idx = index_of_next_unescaped_slash(idx, cmdstr);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
fatalError("sed: bad format in substitution expression\n");
|
fatalError("bad format in substitution expression\n");
|
||||||
sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx);
|
sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx);
|
||||||
|
|
||||||
/* process the flags */
|
/* process the flags */
|
||||||
@ -285,7 +285,7 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
|
|||||||
cflags |= REG_ICASE;
|
cflags |= REG_ICASE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fatalError("sed: bad option in substitution expression\n");
|
fatalError("bad option in substitution expression\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
sh.c
10
sh.c
@ -850,7 +850,7 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
|
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
|
||||||
fatalError("sh: %s: %s\n", newJob.progs[i].argv[0],
|
fatalError("%s: %s\n", newJob.progs[i].argv[0],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,7 +1043,7 @@ int shell_main(int argc, char **argv)
|
|||||||
/* initialize the cwd */
|
/* initialize the cwd */
|
||||||
cwd = (char *) calloc(BUFSIZ, sizeof(char));
|
cwd = (char *) calloc(BUFSIZ, sizeof(char));
|
||||||
if (cwd == 0) {
|
if (cwd == 0) {
|
||||||
fatalError("sh: out of memory\n");
|
fatalError("out of memory\n");
|
||||||
}
|
}
|
||||||
getcwd(cwd, sizeof(char)*BUFSIZ);
|
getcwd(cwd, sizeof(char)*BUFSIZ);
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ int shell_main(int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
|
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
|
||||||
if (local_pending_command == 0) {
|
if (local_pending_command == 0) {
|
||||||
fatalError("sh: out of memory\n");
|
fatalError("out of memory\n");
|
||||||
}
|
}
|
||||||
for(i=2; i<argc; i++)
|
for(i=2; i<argc; i++)
|
||||||
{
|
{
|
||||||
@ -1073,7 +1073,7 @@ int shell_main(int argc, char **argv)
|
|||||||
local_pending_command = realloc(local_pending_command,
|
local_pending_command = realloc(local_pending_command,
|
||||||
strlen(local_pending_command) + strlen(argv[i]));
|
strlen(local_pending_command) + strlen(argv[i]));
|
||||||
if (local_pending_command==NULL)
|
if (local_pending_command==NULL)
|
||||||
fatalError("sh: commands for -c option too long\n");
|
fatalError("commands for -c option too long\n");
|
||||||
}
|
}
|
||||||
strcat(local_pending_command, argv[i]);
|
strcat(local_pending_command, argv[i]);
|
||||||
if ( (i + 1) < argc)
|
if ( (i + 1) < argc)
|
||||||
@ -1088,7 +1088,7 @@ int shell_main(int argc, char **argv)
|
|||||||
else {
|
else {
|
||||||
input = fopen(argv[1], "r");
|
input = fopen(argv[1], "r");
|
||||||
if (!input) {
|
if (!input) {
|
||||||
fatalError("sh: Couldn't open file '%s': %s\n", argv[1],
|
fatalError("Couldn't open file '%s': %s\n", argv[1],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
shell/lash.c
10
shell/lash.c
@ -850,7 +850,7 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
|
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
|
||||||
fatalError("sh: %s: %s\n", newJob.progs[i].argv[0],
|
fatalError("%s: %s\n", newJob.progs[i].argv[0],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,7 +1043,7 @@ int shell_main(int argc, char **argv)
|
|||||||
/* initialize the cwd */
|
/* initialize the cwd */
|
||||||
cwd = (char *) calloc(BUFSIZ, sizeof(char));
|
cwd = (char *) calloc(BUFSIZ, sizeof(char));
|
||||||
if (cwd == 0) {
|
if (cwd == 0) {
|
||||||
fatalError("sh: out of memory\n");
|
fatalError("out of memory\n");
|
||||||
}
|
}
|
||||||
getcwd(cwd, sizeof(char)*BUFSIZ);
|
getcwd(cwd, sizeof(char)*BUFSIZ);
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ int shell_main(int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
|
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
|
||||||
if (local_pending_command == 0) {
|
if (local_pending_command == 0) {
|
||||||
fatalError("sh: out of memory\n");
|
fatalError("out of memory\n");
|
||||||
}
|
}
|
||||||
for(i=2; i<argc; i++)
|
for(i=2; i<argc; i++)
|
||||||
{
|
{
|
||||||
@ -1073,7 +1073,7 @@ int shell_main(int argc, char **argv)
|
|||||||
local_pending_command = realloc(local_pending_command,
|
local_pending_command = realloc(local_pending_command,
|
||||||
strlen(local_pending_command) + strlen(argv[i]));
|
strlen(local_pending_command) + strlen(argv[i]));
|
||||||
if (local_pending_command==NULL)
|
if (local_pending_command==NULL)
|
||||||
fatalError("sh: commands for -c option too long\n");
|
fatalError("commands for -c option too long\n");
|
||||||
}
|
}
|
||||||
strcat(local_pending_command, argv[i]);
|
strcat(local_pending_command, argv[i]);
|
||||||
if ( (i + 1) < argc)
|
if ( (i + 1) < argc)
|
||||||
@ -1088,7 +1088,7 @@ int shell_main(int argc, char **argv)
|
|||||||
else {
|
else {
|
||||||
input = fopen(argv[1], "r");
|
input = fopen(argv[1], "r");
|
||||||
if (!input) {
|
if (!input) {
|
||||||
fatalError("sh: Couldn't open file '%s': %s\n", argv[1],
|
fatalError("Couldn't open file '%s': %s\n", argv[1],
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
36
tar.c
36
tar.c
@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
}
|
}
|
||||||
if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
|
if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
|
||||||
/* Tarball seems to have a problem */
|
/* Tarball seems to have a problem */
|
||||||
errorMsg("tar: Unexpected EOF in archive\n");
|
errorMsg("Unexpected EOF in archive\n");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
if ( readSize < writeSize )
|
if ( readSize < writeSize )
|
||||||
@ -368,7 +368,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
return( TRUE);
|
return( TRUE);
|
||||||
|
|
||||||
if (createPath(header->name, header->mode) != TRUE) {
|
if (createPath(header->name, header->mode) != TRUE) {
|
||||||
errorMsg("tar: %s: Cannot mkdir: %s\n",
|
errorMsg("%s: Cannot mkdir: %s\n",
|
||||||
header->name, strerror(errno));
|
header->name, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
return( TRUE);
|
return( TRUE);
|
||||||
|
|
||||||
if (link(header->linkname, header->name) < 0) {
|
if (link(header->linkname, header->name) < 0) {
|
||||||
errorMsg("tar: %s: Cannot create hard link to '%s': %s\n",
|
errorMsg("%s: Cannot create hard link to '%s': %s\n",
|
||||||
header->name, header->linkname, strerror(errno));
|
header->name, header->linkname, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -406,7 +406,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
|
|
||||||
#ifdef S_ISLNK
|
#ifdef S_ISLNK
|
||||||
if (symlink(header->linkname, header->name) < 0) {
|
if (symlink(header->linkname, header->name) < 0) {
|
||||||
errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
|
errorMsg("%s: Cannot create symlink to '%s': %s\n",
|
||||||
header->name, header->linkname, strerror(errno));
|
header->name, header->linkname, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
/* Do not change permissions or date on symlink,
|
/* Do not change permissions or date on symlink,
|
||||||
* since it changes the pointed to file instead. duh. */
|
* since it changes the pointed to file instead. duh. */
|
||||||
#else
|
#else
|
||||||
errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
|
errorMsg("%s: Cannot create symlink to '%s': %s\n",
|
||||||
header->name, header->linkname,
|
header->name, header->linkname,
|
||||||
"symlinks not supported");
|
"symlinks not supported");
|
||||||
#endif
|
#endif
|
||||||
@ -436,13 +436,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
|
|
||||||
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
|
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
|
||||||
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
|
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
|
||||||
errorMsg("tar: %s: Cannot mknod: %s\n",
|
errorMsg("%s: Cannot mknod: %s\n",
|
||||||
header->name, strerror(errno));
|
header->name, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
} else if (S_ISFIFO(header->mode)) {
|
} else if (S_ISFIFO(header->mode)) {
|
||||||
if (mkfifo(header->name, header->mode) < 0) {
|
if (mkfifo(header->name, header->mode) < 0) {
|
||||||
errorMsg("tar: %s: Cannot mkfifo: %s\n",
|
errorMsg("%s: Cannot mkfifo: %s\n",
|
||||||
header->name, strerror(errno));
|
header->name, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -490,7 +490,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header)
|
|||||||
++*(header->name);
|
++*(header->name);
|
||||||
|
|
||||||
if (alreadyWarned == FALSE) {
|
if (alreadyWarned == FALSE) {
|
||||||
errorMsg("tar: Removing leading '/' from member names\n");
|
errorMsg("Removing leading '/' from member names\n");
|
||||||
alreadyWarned = TRUE;
|
alreadyWarned = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -695,7 +695,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
|
|||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
else if (errorFlag==TRUE) {
|
else if (errorFlag==TRUE) {
|
||||||
errorMsg( "tar: Error exit delayed from previous errors\n");
|
errorMsg( "Error exit delayed from previous errors\n");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
} else
|
} else
|
||||||
return( status);
|
return( status);
|
||||||
@ -705,7 +705,7 @@ endgame:
|
|||||||
close( tarFd);
|
close( tarFd);
|
||||||
if ( *(header.name) == '\0' ) {
|
if ( *(header.name) == '\0' ) {
|
||||||
if (errorFlag==TRUE)
|
if (errorFlag==TRUE)
|
||||||
errorMsg( "tar: Error exit delayed from previous errors\n");
|
errorMsg( "Error exit delayed from previous errors\n");
|
||||||
else
|
else
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
|
|||||||
if (*fileName=='/') {
|
if (*fileName=='/') {
|
||||||
static int alreadyWarned=FALSE;
|
static int alreadyWarned=FALSE;
|
||||||
if (alreadyWarned==FALSE) {
|
if (alreadyWarned==FALSE) {
|
||||||
errorMsg("tar: Removing leading '/' from member names\n");
|
errorMsg("Removing leading '/' from member names\n");
|
||||||
alreadyWarned=TRUE;
|
alreadyWarned=TRUE;
|
||||||
}
|
}
|
||||||
strncpy(header.name, fileName+1, sizeof(header.name));
|
strncpy(header.name, fileName+1, sizeof(header.name));
|
||||||
@ -854,7 +854,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
|
|||||||
header.typeflag = REGTYPE;
|
header.typeflag = REGTYPE;
|
||||||
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
||||||
} else {
|
} else {
|
||||||
errorMsg("tar: %s: Unknown file type\n", fileName);
|
errorMsg("%s: Unknown file type\n", fileName);
|
||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,7 +892,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
|
|
||||||
/* It is against the rules to archive a socket */
|
/* It is against the rules to archive a socket */
|
||||||
if (S_ISSOCK(statbuf->st_mode)) {
|
if (S_ISSOCK(statbuf->st_mode)) {
|
||||||
errorMsg("tar: %s: socket ignored\n", fileName);
|
errorMsg("%s: socket ignored\n", fileName);
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,7 +901,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
* the new tarball */
|
* the new tarball */
|
||||||
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
||||||
tbInfo->statBuf.st_ino == statbuf->st_ino) {
|
tbInfo->statBuf.st_ino == statbuf->st_ino) {
|
||||||
errorMsg("tar: %s: file is the archive; skipping\n", fileName);
|
errorMsg("%s: file is the archive; skipping\n", fileName);
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -917,7 +917,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
|
|
||||||
/* open the file we want to archive, and make sure all is well */
|
/* open the file we want to archive, and make sure all is well */
|
||||||
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
|
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
|
||||||
errorMsg("tar: %s: Cannot open: %s\n", fileName, strerror(errno));
|
errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno));
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,7 +955,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag,
|
|||||||
|
|
||||||
/* Make sure there is at least one file to tar up. */
|
/* Make sure there is at least one file to tar up. */
|
||||||
if (argc <= 0)
|
if (argc <= 0)
|
||||||
fatalError("tar: Cowardly refusing to create an empty archive\n");
|
fatalError("Cowardly refusing to create an empty archive\n");
|
||||||
|
|
||||||
/* Open the tar file for writing. */
|
/* Open the tar file for writing. */
|
||||||
if (tostdoutFlag == TRUE)
|
if (tostdoutFlag == TRUE)
|
||||||
@ -963,7 +963,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag,
|
|||||||
else
|
else
|
||||||
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
if (tbInfo.tarFd < 0) {
|
if (tbInfo.tarFd < 0) {
|
||||||
errorMsg( "tar: Error opening '%s': %s\n", tarName, strerror(errno));
|
errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
|
||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
tbInfo.excludeList=excludeList;
|
tbInfo.excludeList=excludeList;
|
||||||
@ -997,7 +997,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag,
|
|||||||
/* Hang up the tools, close up shop, head home */
|
/* Hang up the tools, close up shop, head home */
|
||||||
close(tarFd);
|
close(tarFd);
|
||||||
if (errorFlag == TRUE) {
|
if (errorFlag == TRUE) {
|
||||||
errorMsg("tar: Error exit delayed from previous errors\n");
|
errorMsg("Error exit delayed from previous errors\n");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
|
4
touch.c
4
touch.c
@ -70,12 +70,12 @@ extern int touch_main(int argc, char **argv)
|
|||||||
if (create == FALSE && errno == ENOENT)
|
if (create == FALSE && errno == ENOENT)
|
||||||
exit(TRUE);
|
exit(TRUE);
|
||||||
else {
|
else {
|
||||||
fatalError("touch: %s", strerror(errno));
|
fatalError("%s", strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
if (utime(*argv, NULL)) {
|
if (utime(*argv, NULL)) {
|
||||||
fatalError("touch: %s", strerror(errno));
|
fatalError("%s", strerror(errno));
|
||||||
}
|
}
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
2
tr.c
2
tr.c
@ -189,7 +189,7 @@ extern int tr_main(int argc, char **argv)
|
|||||||
complement(input);
|
complement(input);
|
||||||
if (argv[index] != NULL) {
|
if (argv[index] != NULL) {
|
||||||
if (*argv[index] == '\0')
|
if (*argv[index] == '\0')
|
||||||
fatalError("tr: STRING2 cannot be empty\n");
|
fatalError("STRING2 cannot be empty\n");
|
||||||
expand(argv[index], output);
|
expand(argv[index], output);
|
||||||
map(input, output);
|
map(input, output);
|
||||||
}
|
}
|
||||||
|
2
umount.c
2
umount.c
@ -201,7 +201,7 @@ static int do_umount(const char *name, int useMtab)
|
|||||||
if (status != 0 && doForce == TRUE) {
|
if (status != 0 && doForce == TRUE) {
|
||||||
status = umount2(blockDevice, MNT_FORCE);
|
status = umount2(blockDevice, MNT_FORCE);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fatalError("umount: forced umount of %s failed!\n", blockDevice);
|
fatalError("forced umount of %s failed!\n", blockDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,10 +52,10 @@ freeramdisk_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((f = open(argv[1], O_RDWR)) == -1) {
|
if ((f = open(argv[1], O_RDWR)) == -1) {
|
||||||
fatalError( "freeramdisk: cannot open %s: %s\n", argv[1], strerror(errno));
|
fatalError( "cannot open %s: %s\n", argv[1], strerror(errno));
|
||||||
}
|
}
|
||||||
if (ioctl(f, BLKFLSBUF) < 0) {
|
if (ioctl(f, BLKFLSBUF) < 0) {
|
||||||
fatalError( "freeramdisk: failed ioctl on %s: %s\n", argv[1], strerror(errno));
|
fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
|
||||||
}
|
}
|
||||||
/* Don't bother closing. Exit does
|
/* Don't bother closing. Exit does
|
||||||
* that, so we can save a few bytes */
|
* that, so we can save a few bytes */
|
||||||
|
@ -193,7 +193,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (errno == EPERM) {
|
if (errno == EPERM) {
|
||||||
fatalError("mount: permission denied. Are you root?\n");
|
fatalError("permission denied. Are you root?\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
@ -201,7 +201,7 @@ static int do_umount(const char *name, int useMtab)
|
|||||||
if (status != 0 && doForce == TRUE) {
|
if (status != 0 && doForce == TRUE) {
|
||||||
status = umount2(blockDevice, MNT_FORCE);
|
status = umount2(blockDevice, MNT_FORCE);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
fatalError("umount: forced umount of %s failed!\n", blockDevice);
|
fatalError("forced umount of %s failed!\n", blockDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
10
utility.c
10
utility.c
@ -94,6 +94,7 @@ extern void errorMsg(const char *s, ...)
|
|||||||
|
|
||||||
va_start(p, s);
|
va_start(p, s);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
fprintf(stderr, "%s: ", applet_name);
|
||||||
vfprintf(stderr, s, p);
|
vfprintf(stderr, s, p);
|
||||||
va_end(p);
|
va_end(p);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@ -105,6 +106,7 @@ extern void fatalError(const char *s, ...)
|
|||||||
|
|
||||||
va_start(p, s);
|
va_start(p, s);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
fprintf(stderr, "%s: ", applet_name);
|
||||||
vfprintf(stderr, s, p);
|
vfprintf(stderr, s, p);
|
||||||
va_end(p);
|
va_end(p);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@ -1360,7 +1362,7 @@ extern pid_t* findPidByName( char* pidName)
|
|||||||
&& (strlen(pidName) == strlen(info.command_line))) {
|
&& (strlen(pidName) == strlen(info.command_line))) {
|
||||||
pidList=realloc( pidList, sizeof(pid_t) * (j+2));
|
pidList=realloc( pidList, sizeof(pid_t) * (j+2));
|
||||||
if (pidList==NULL)
|
if (pidList==NULL)
|
||||||
fatalError(memory_exhausted, "");
|
fatalError(memory_exhausted);
|
||||||
pidList[j++]=info.pid;
|
pidList[j++]=info.pid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1433,7 +1435,7 @@ extern pid_t* findPidByName( char* pidName)
|
|||||||
&& (strlen(pidName) == strlen(p))) {
|
&& (strlen(pidName) == strlen(p))) {
|
||||||
pidList=realloc( pidList, sizeof(pid_t) * (i+2));
|
pidList=realloc( pidList, sizeof(pid_t) * (i+2));
|
||||||
if (pidList==NULL)
|
if (pidList==NULL)
|
||||||
fatalError(memory_exhausted, "");
|
fatalError(memory_exhausted);
|
||||||
pidList[i++]=strtol(next->d_name, NULL, 0);
|
pidList[i++]=strtol(next->d_name, NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1450,7 +1452,7 @@ extern void *xmalloc(size_t size)
|
|||||||
void *cp = malloc(size);
|
void *cp = malloc(size);
|
||||||
|
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
fatalError(memory_exhausted, "");
|
fatalError(memory_exhausted);
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1464,7 +1466,7 @@ extern char * xstrdup (const char *s) {
|
|||||||
t = strdup (s);
|
t = strdup (s);
|
||||||
|
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
fatalError(memory_exhausted, "");
|
fatalError(memory_exhausted);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ static int decode (const char *inname,
|
|||||||
&& (freopen (outname, "w", stdout) == NULL
|
&& (freopen (outname, "w", stdout) == NULL
|
||||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||||
)) {
|
)) {
|
||||||
errorMsg("uudeoce %s: %s %s\n", outname, inname, strerror(errno)); /* */
|
errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ int uudecode_main (int argc,
|
|||||||
if (decode (argv[optind], outname) != 0)
|
if (decode (argv[optind], outname) != 0)
|
||||||
exit_status = FALSE;
|
exit_status = FALSE;
|
||||||
} else {
|
} else {
|
||||||
errorMsg("uudecode: %s: %s\n", argv[optind], strerror(errno));
|
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||||
exit_status = FALSE;
|
exit_status = FALSE;
|
||||||
}
|
}
|
||||||
optind++;
|
optind++;
|
||||||
|
@ -217,7 +217,7 @@ int uuencode_main (int argc,
|
|||||||
case 2:
|
case 2:
|
||||||
/* Optional first argument is input file. */
|
/* Optional first argument is input file. */
|
||||||
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
||||||
errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno));
|
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||||
exit FALSE;
|
exit FALSE;
|
||||||
}
|
}
|
||||||
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
|
Loading…
Reference in New Issue
Block a user