diff options
author | Matt Kraai <kraai@debian.org> | 2000-07-12 17:02:35 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2000-07-12 17:02:35 +0000 |
commit | be84cd4ef66f8956eb4c7ff0542fd1ba823a70e7 (patch) | |
tree | 088bc5b6e06d693ad8ca3eba078c0f3a8e302a24 | |
parent | e58771e73c0d8589a458ede4088f5ba70eff917b (diff) | |
download | busybox-w32-be84cd4ef66f8956eb4c7ff0542fd1ba823a70e7.tar.gz busybox-w32-be84cd4ef66f8956eb4c7ff0542fd1ba823a70e7.tar.bz2 busybox-w32-be84cd4ef66f8956eb4c7ff0542fd1ba823a70e7.zip |
Always report the applet name when doing error reporting.
-rw-r--r-- | ar.c | 6 | ||||
-rw-r--r-- | archival/ar.c | 6 | ||||
-rw-r--r-- | archival/gunzip.c | 4 | ||||
-rw-r--r-- | archival/gzip.c | 4 | ||||
-rw-r--r-- | archival/tar.c | 36 | ||||
-rw-r--r-- | chmod_chown_chgrp.c | 9 | ||||
-rw-r--r-- | chroot.c | 6 | ||||
-rw-r--r-- | coreutils/chroot.c | 6 | ||||
-rw-r--r-- | coreutils/date.c | 10 | ||||
-rw-r--r-- | coreutils/md5sum.c | 8 | ||||
-rw-r--r-- | coreutils/pwd.c | 2 | ||||
-rw-r--r-- | coreutils/touch.c | 4 | ||||
-rw-r--r-- | coreutils/tr.c | 2 | ||||
-rw-r--r-- | coreutils/uudecode.c | 4 | ||||
-rw-r--r-- | coreutils/uuencode.c | 2 | ||||
-rw-r--r-- | date.c | 10 | ||||
-rw-r--r-- | editors/sed.c | 14 | ||||
-rw-r--r-- | freeramdisk.c | 4 | ||||
-rw-r--r-- | gunzip.c | 4 | ||||
-rw-r--r-- | gzip.c | 4 | ||||
-rw-r--r-- | lash.c | 10 | ||||
-rw-r--r-- | md5sum.c | 8 | ||||
-rw-r--r-- | messages.c | 4 | ||||
-rw-r--r-- | mount.c | 2 | ||||
-rw-r--r-- | nc.c | 2 | ||||
-rw-r--r-- | networking/nc.c | 2 | ||||
-rw-r--r-- | networking/ping.c | 4 | ||||
-rw-r--r-- | ping.c | 4 | ||||
-rw-r--r-- | pwd.c | 2 | ||||
-rw-r--r-- | sed.c | 14 | ||||
-rw-r--r-- | sh.c | 10 | ||||
-rw-r--r-- | shell/lash.c | 10 | ||||
-rw-r--r-- | tar.c | 36 | ||||
-rw-r--r-- | touch.c | 4 | ||||
-rw-r--r-- | tr.c | 2 | ||||
-rw-r--r-- | umount.c | 2 | ||||
-rw-r--r-- | util-linux/freeramdisk.c | 4 | ||||
-rw-r--r-- | util-linux/mount.c | 2 | ||||
-rw-r--r-- | util-linux/umount.c | 2 | ||||
-rw-r--r-- | utility.c | 10 | ||||
-rw-r--r-- | uudecode.c | 4 | ||||
-rw-r--r-- | uuencode.c | 2 |
42 files changed, 141 insertions, 144 deletions
@@ -158,12 +158,12 @@ static int copySubFile(int srcFd, int dstFd, int copySize) | |||
158 | readSize = copySize; | 158 | readSize = copySize; |
159 | writeSize = fullRead(srcFd, buffer, readSize); | 159 | writeSize = fullRead(srcFd, buffer, readSize); |
160 | if (writeSize <= 0) { | 160 | if (writeSize <= 0) { |
161 | errorMsg(io_error, "copySubFile :", strerror(errno)); | 161 | errorMsg(io_error, "copySubFile", strerror(errno)); |
162 | return (FALSE); | 162 | return (FALSE); |
163 | } | 163 | } |
164 | doneSize = fullWrite(dstFd, buffer, writeSize); | 164 | doneSize = fullWrite(dstFd, buffer, writeSize); |
165 | if (doneSize <= 0) { | 165 | if (doneSize <= 0) { |
166 | errorMsg(io_error, "copySubFile :", strerror(errno)); | 166 | errorMsg(io_error, "copySubFile", strerror(errno)); |
167 | return (FALSE); | 167 | return (FALSE); |
168 | } | 168 | } |
169 | copySize -= doneSize; | 169 | copySize -= doneSize; |
@@ -220,7 +220,7 @@ static int getArFd(char *filename) | |||
220 | return (FALSE); | 220 | return (FALSE); |
221 | } | 221 | } |
222 | if (fullRead(arFd, arVersion, 8) <= 0) { | 222 | if (fullRead(arFd, arVersion, 8) <= 0) { |
223 | errorMsg( "ar: Unexpected EOF in archive\n"); | 223 | errorMsg( "Unexpected EOF in archive\n"); |
224 | return (FALSE); | 224 | return (FALSE); |
225 | } | 225 | } |
226 | if (strncmp(arVersion,"!<arch>",7) != 0) { | 226 | if (strncmp(arVersion,"!<arch>",7) != 0) { |
diff --git a/archival/ar.c b/archival/ar.c index 27dfadd1d..a43cc1dff 100644 --- a/archival/ar.c +++ b/archival/ar.c | |||
@@ -158,12 +158,12 @@ static int copySubFile(int srcFd, int dstFd, int copySize) | |||
158 | readSize = copySize; | 158 | readSize = copySize; |
159 | writeSize = fullRead(srcFd, buffer, readSize); | 159 | writeSize = fullRead(srcFd, buffer, readSize); |
160 | if (writeSize <= 0) { | 160 | if (writeSize <= 0) { |
161 | errorMsg(io_error, "copySubFile :", strerror(errno)); | 161 | errorMsg(io_error, "copySubFile", strerror(errno)); |
162 | return (FALSE); | 162 | return (FALSE); |
163 | } | 163 | } |
164 | doneSize = fullWrite(dstFd, buffer, writeSize); | 164 | doneSize = fullWrite(dstFd, buffer, writeSize); |
165 | if (doneSize <= 0) { | 165 | if (doneSize <= 0) { |
166 | errorMsg(io_error, "copySubFile :", strerror(errno)); | 166 | errorMsg(io_error, "copySubFile", strerror(errno)); |
167 | return (FALSE); | 167 | return (FALSE); |
168 | } | 168 | } |
169 | copySize -= doneSize; | 169 | copySize -= doneSize; |
@@ -220,7 +220,7 @@ static int getArFd(char *filename) | |||
220 | return (FALSE); | 220 | return (FALSE); |
221 | } | 221 | } |
222 | if (fullRead(arFd, arVersion, 8) <= 0) { | 222 | if (fullRead(arFd, arVersion, 8) <= 0) { |
223 | errorMsg( "ar: Unexpected EOF in archive\n"); | 223 | errorMsg( "Unexpected EOF in archive\n"); |
224 | return (FALSE); | 224 | return (FALSE); |
225 | } | 225 | } |
226 | if (strncmp(arVersion,"!<arch>",7) != 0) { | 226 | if (strncmp(arVersion,"!<arch>",7) != 0) { |
diff --git a/archival/gunzip.c b/archival/gunzip.c index e6b8202c8..89e46a686 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -212,7 +212,7 @@ extern int method; /* compression method */ | |||
212 | # define DECLARE(type, array, size) type * array | 212 | # define DECLARE(type, array, size) type * array |
213 | # define ALLOC(type, array, size) { \ | 213 | # define ALLOC(type, array, size) { \ |
214 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 214 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
215 | if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \ | 215 | if (array == NULL) errorMsg(memory_exhausted); \ |
216 | } | 216 | } |
217 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 217 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
218 | #else | 218 | #else |
@@ -930,7 +930,7 @@ int in, out; /* input and output file descriptors */ | |||
930 | int res = inflate(); | 930 | int res = inflate(); |
931 | 931 | ||
932 | if (res == 3) { | 932 | if (res == 3) { |
933 | errorMsg(memory_exhausted, "gunzip"); | 933 | errorMsg(memory_exhausted); |
934 | } else if (res != 0) { | 934 | } else if (res != 0) { |
935 | errorMsg("invalid compressed data--format violated"); | 935 | errorMsg("invalid compressed data--format violated"); |
936 | } | 936 | } |
diff --git a/archival/gzip.c b/archival/gzip.c index 9248cfecd..8bc67d9c6 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -127,7 +127,7 @@ extern int method; /* compression method */ | |||
127 | # define DECLARE(type, array, size) type * array | 127 | # define DECLARE(type, array, size) type * array |
128 | # define ALLOC(type, array, size) { \ | 128 | # define ALLOC(type, array, size) { \ |
129 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 129 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
130 | if (array == NULL) errorMsg(memory_exhausted, "gzip"); \ | 130 | if (array == NULL) errorMsg(memory_exhausted); \ |
131 | } | 131 | } |
132 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 132 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
133 | #else | 133 | #else |
@@ -3251,7 +3251,7 @@ char *env; /* name of environment variable */ | |||
3251 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); | 3251 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); |
3252 | 3252 | ||
3253 | if (nargv == NULL) | 3253 | if (nargv == NULL) |
3254 | errorMsg(memory_exhausted, "gzip"); | 3254 | errorMsg(memory_exhausted); |
3255 | oargv = *argvp; | 3255 | oargv = *argvp; |
3256 | *argvp = nargv; | 3256 | *argvp = nargv; |
3257 | 3257 | ||
diff --git a/archival/tar.c b/archival/tar.c index af017d112..353694f33 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
330 | } | 330 | } |
331 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { | 331 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { |
332 | /* Tarball seems to have a problem */ | 332 | /* Tarball seems to have a problem */ |
333 | errorMsg("tar: Unexpected EOF in archive\n"); | 333 | errorMsg("Unexpected EOF in archive\n"); |
334 | return( FALSE); | 334 | return( FALSE); |
335 | } | 335 | } |
336 | if ( readSize < writeSize ) | 336 | if ( readSize < writeSize ) |
@@ -368,7 +368,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
368 | return( TRUE); | 368 | return( TRUE); |
369 | 369 | ||
370 | if (createPath(header->name, header->mode) != TRUE) { | 370 | if (createPath(header->name, header->mode) != TRUE) { |
371 | errorMsg("tar: %s: Cannot mkdir: %s\n", | 371 | errorMsg("%s: Cannot mkdir: %s\n", |
372 | header->name, strerror(errno)); | 372 | header->name, strerror(errno)); |
373 | return( FALSE); | 373 | return( FALSE); |
374 | } | 374 | } |
@@ -388,7 +388,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
388 | return( TRUE); | 388 | return( TRUE); |
389 | 389 | ||
390 | if (link(header->linkname, header->name) < 0) { | 390 | if (link(header->linkname, header->name) < 0) { |
391 | errorMsg("tar: %s: Cannot create hard link to '%s': %s\n", | 391 | errorMsg("%s: Cannot create hard link to '%s': %s\n", |
392 | header->name, header->linkname, strerror(errno)); | 392 | header->name, header->linkname, strerror(errno)); |
393 | return( FALSE); | 393 | return( FALSE); |
394 | } | 394 | } |
@@ -406,7 +406,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
406 | 406 | ||
407 | #ifdef S_ISLNK | 407 | #ifdef S_ISLNK |
408 | if (symlink(header->linkname, header->name) < 0) { | 408 | if (symlink(header->linkname, header->name) < 0) { |
409 | errorMsg("tar: %s: Cannot create symlink to '%s': %s\n", | 409 | errorMsg("%s: Cannot create symlink to '%s': %s\n", |
410 | header->name, header->linkname, strerror(errno)); | 410 | header->name, header->linkname, strerror(errno)); |
411 | return( FALSE); | 411 | return( FALSE); |
412 | } | 412 | } |
@@ -421,7 +421,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
421 | /* Do not change permissions or date on symlink, | 421 | /* Do not change permissions or date on symlink, |
422 | * since it changes the pointed to file instead. duh. */ | 422 | * since it changes the pointed to file instead. duh. */ |
423 | #else | 423 | #else |
424 | errorMsg("tar: %s: Cannot create symlink to '%s': %s\n", | 424 | errorMsg("%s: Cannot create symlink to '%s': %s\n", |
425 | header->name, header->linkname, | 425 | header->name, header->linkname, |
426 | "symlinks not supported"); | 426 | "symlinks not supported"); |
427 | #endif | 427 | #endif |
@@ -436,13 +436,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
436 | 436 | ||
437 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { | 437 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { |
438 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { | 438 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { |
439 | errorMsg("tar: %s: Cannot mknod: %s\n", | 439 | errorMsg("%s: Cannot mknod: %s\n", |
440 | header->name, strerror(errno)); | 440 | header->name, strerror(errno)); |
441 | return( FALSE); | 441 | return( FALSE); |
442 | } | 442 | } |
443 | } else if (S_ISFIFO(header->mode)) { | 443 | } else if (S_ISFIFO(header->mode)) { |
444 | if (mkfifo(header->name, header->mode) < 0) { | 444 | if (mkfifo(header->name, header->mode) < 0) { |
445 | errorMsg("tar: %s: Cannot mkfifo: %s\n", | 445 | errorMsg("%s: Cannot mkfifo: %s\n", |
446 | header->name, strerror(errno)); | 446 | header->name, strerror(errno)); |
447 | return( FALSE); | 447 | return( FALSE); |
448 | } | 448 | } |
@@ -490,7 +490,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) | |||
490 | ++*(header->name); | 490 | ++*(header->name); |
491 | 491 | ||
492 | if (alreadyWarned == FALSE) { | 492 | if (alreadyWarned == FALSE) { |
493 | errorMsg("tar: Removing leading '/' from member names\n"); | 493 | errorMsg("Removing leading '/' from member names\n"); |
494 | alreadyWarned = TRUE; | 494 | alreadyWarned = TRUE; |
495 | } | 495 | } |
496 | } | 496 | } |
@@ -695,7 +695,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
695 | return ( FALSE); | 695 | return ( FALSE); |
696 | } | 696 | } |
697 | else if (errorFlag==TRUE) { | 697 | else if (errorFlag==TRUE) { |
698 | errorMsg( "tar: Error exit delayed from previous errors\n"); | 698 | errorMsg( "Error exit delayed from previous errors\n"); |
699 | return( FALSE); | 699 | return( FALSE); |
700 | } else | 700 | } else |
701 | return( status); | 701 | return( status); |
@@ -705,7 +705,7 @@ endgame: | |||
705 | close( tarFd); | 705 | close( tarFd); |
706 | if ( *(header.name) == '\0' ) { | 706 | if ( *(header.name) == '\0' ) { |
707 | if (errorFlag==TRUE) | 707 | if (errorFlag==TRUE) |
708 | errorMsg( "tar: Error exit delayed from previous errors\n"); | 708 | errorMsg( "Error exit delayed from previous errors\n"); |
709 | else | 709 | else |
710 | return( TRUE); | 710 | return( TRUE); |
711 | } | 711 | } |
@@ -782,7 +782,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
782 | if (*fileName=='/') { | 782 | if (*fileName=='/') { |
783 | static int alreadyWarned=FALSE; | 783 | static int alreadyWarned=FALSE; |
784 | if (alreadyWarned==FALSE) { | 784 | if (alreadyWarned==FALSE) { |
785 | errorMsg("tar: Removing leading '/' from member names\n"); | 785 | errorMsg("Removing leading '/' from member names\n"); |
786 | alreadyWarned=TRUE; | 786 | alreadyWarned=TRUE; |
787 | } | 787 | } |
788 | strncpy(header.name, fileName+1, sizeof(header.name)); | 788 | strncpy(header.name, fileName+1, sizeof(header.name)); |
@@ -854,7 +854,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
854 | header.typeflag = REGTYPE; | 854 | header.typeflag = REGTYPE; |
855 | putOctal(header.size, sizeof(header.size), statbuf->st_size); | 855 | putOctal(header.size, sizeof(header.size), statbuf->st_size); |
856 | } else { | 856 | } else { |
857 | errorMsg("tar: %s: Unknown file type\n", fileName); | 857 | errorMsg("%s: Unknown file type\n", fileName); |
858 | return ( FALSE); | 858 | return ( FALSE); |
859 | } | 859 | } |
860 | 860 | ||
@@ -892,7 +892,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
892 | 892 | ||
893 | /* It is against the rules to archive a socket */ | 893 | /* It is against the rules to archive a socket */ |
894 | if (S_ISSOCK(statbuf->st_mode)) { | 894 | if (S_ISSOCK(statbuf->st_mode)) { |
895 | errorMsg("tar: %s: socket ignored\n", fileName); | 895 | errorMsg("%s: socket ignored\n", fileName); |
896 | return( TRUE); | 896 | return( TRUE); |
897 | } | 897 | } |
898 | 898 | ||
@@ -901,7 +901,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
901 | * the new tarball */ | 901 | * the new tarball */ |
902 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && | 902 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && |
903 | tbInfo->statBuf.st_ino == statbuf->st_ino) { | 903 | tbInfo->statBuf.st_ino == statbuf->st_ino) { |
904 | errorMsg("tar: %s: file is the archive; skipping\n", fileName); | 904 | errorMsg("%s: file is the archive; skipping\n", fileName); |
905 | return( TRUE); | 905 | return( TRUE); |
906 | } | 906 | } |
907 | 907 | ||
@@ -917,7 +917,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
917 | 917 | ||
918 | /* open the file we want to archive, and make sure all is well */ | 918 | /* open the file we want to archive, and make sure all is well */ |
919 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { | 919 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { |
920 | errorMsg("tar: %s: Cannot open: %s\n", fileName, strerror(errno)); | 920 | errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno)); |
921 | return( FALSE); | 921 | return( FALSE); |
922 | } | 922 | } |
923 | 923 | ||
@@ -955,7 +955,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
955 | 955 | ||
956 | /* Make sure there is at least one file to tar up. */ | 956 | /* Make sure there is at least one file to tar up. */ |
957 | if (argc <= 0) | 957 | if (argc <= 0) |
958 | fatalError("tar: Cowardly refusing to create an empty archive\n"); | 958 | fatalError("Cowardly refusing to create an empty archive\n"); |
959 | 959 | ||
960 | /* Open the tar file for writing. */ | 960 | /* Open the tar file for writing. */ |
961 | if (tostdoutFlag == TRUE) | 961 | if (tostdoutFlag == TRUE) |
@@ -963,7 +963,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
963 | else | 963 | else |
964 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); | 964 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
965 | if (tbInfo.tarFd < 0) { | 965 | if (tbInfo.tarFd < 0) { |
966 | errorMsg( "tar: Error opening '%s': %s\n", tarName, strerror(errno)); | 966 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
967 | return ( FALSE); | 967 | return ( FALSE); |
968 | } | 968 | } |
969 | tbInfo.excludeList=excludeList; | 969 | tbInfo.excludeList=excludeList; |
@@ -997,7 +997,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
997 | /* Hang up the tools, close up shop, head home */ | 997 | /* Hang up the tools, close up shop, head home */ |
998 | close(tarFd); | 998 | close(tarFd); |
999 | if (errorFlag == TRUE) { | 999 | if (errorFlag == TRUE) { |
1000 | errorMsg("tar: Error exit delayed from previous errors\n"); | 1000 | errorMsg("Error exit delayed from previous errors\n"); |
1001 | return(FALSE); | 1001 | return(FALSE); |
1002 | } | 1002 | } |
1003 | return( TRUE); | 1003 | return( TRUE); |
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index a5d9af491..98b292568 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c | |||
@@ -87,7 +87,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | |||
87 | case CHMOD_APP: | 87 | case CHMOD_APP: |
88 | /* Parse the specified modes */ | 88 | /* Parse the specified modes */ |
89 | if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) { | 89 | if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) { |
90 | fatalError( "%s: unknown mode: %s\n", applet_name, theMode); | 90 | fatalError( "unknown mode: %s\n", theMode); |
91 | } | 91 | } |
92 | if (chmod(fileName, statbuf->st_mode) == 0) | 92 | if (chmod(fileName, statbuf->st_mode) == 0) |
93 | return (TRUE); | 93 | return (TRUE); |
@@ -169,15 +169,14 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
169 | if (*argv == p) | 169 | if (*argv == p) |
170 | uid = my_getpwnam(*argv); | 170 | uid = my_getpwnam(*argv); |
171 | if (uid == -1) { | 171 | if (uid == -1) { |
172 | fatalError( "%s: unknown user name: %s\n", | 172 | fatalError( "unknown user name: %s\n", *argv); |
173 | applet_name, *argv); | ||
174 | } | 173 | } |
175 | } | 174 | } |
176 | } | 175 | } |
177 | 176 | ||
178 | /* Ok, ready to do the deed now */ | 177 | /* Ok, ready to do the deed now */ |
179 | if (argc <= 1) { | 178 | if (argc <= 1) { |
180 | fatalError( "%s: too few arguments\n", applet_name); | 179 | fatalError( "too few arguments\n"); |
181 | } | 180 | } |
182 | while (argc-- > 1) { | 181 | while (argc-- > 1) { |
183 | if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE, | 182 | if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE, |
@@ -187,7 +186,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
187 | exit(TRUE); | 186 | exit(TRUE); |
188 | 187 | ||
189 | bad_group: | 188 | bad_group: |
190 | fatalError( "%s: unknown group name: %s\n", applet_name, groupName); | 189 | fatalError( "unknown group name: %s\n", groupName); |
191 | } | 190 | } |
192 | 191 | ||
193 | /* | 192 | /* |
@@ -47,8 +47,7 @@ int chroot_main(int argc, char **argv) | |||
47 | argv++; | 47 | argv++; |
48 | 48 | ||
49 | if (chroot(*argv) || (chdir("/"))) { | 49 | if (chroot(*argv) || (chdir("/"))) { |
50 | fatalError("chroot: cannot change root directory to %s: %s\n", | 50 | fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno)); |
51 | *argv, strerror(errno)); | ||
52 | } | 51 | } |
53 | 52 | ||
54 | argc--; | 53 | argc--; |
@@ -62,8 +61,7 @@ int chroot_main(int argc, char **argv) | |||
62 | prog = "/bin/sh"; | 61 | prog = "/bin/sh"; |
63 | execlp(prog, prog, NULL); | 62 | execlp(prog, prog, NULL); |
64 | } | 63 | } |
65 | fatalError("chroot: cannot execute %s: %s\n", | 64 | fatalError("cannot execute %s: %s\n", prog, strerror(errno)); |
66 | prog, strerror(errno)); | ||
67 | 65 | ||
68 | } | 66 | } |
69 | 67 | ||
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index 1c64e08a9..95aed3d17 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c | |||
@@ -47,8 +47,7 @@ int chroot_main(int argc, char **argv) | |||
47 | argv++; | 47 | argv++; |
48 | 48 | ||
49 | if (chroot(*argv) || (chdir("/"))) { | 49 | if (chroot(*argv) || (chdir("/"))) { |
50 | fatalError("chroot: cannot change root directory to %s: %s\n", | 50 | fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno)); |
51 | *argv, strerror(errno)); | ||
52 | } | 51 | } |
53 | 52 | ||
54 | argc--; | 53 | argc--; |
@@ -62,8 +61,7 @@ int chroot_main(int argc, char **argv) | |||
62 | prog = "/bin/sh"; | 61 | prog = "/bin/sh"; |
63 | execlp(prog, prog, NULL); | 62 | execlp(prog, prog, NULL); |
64 | } | 63 | } |
65 | fatalError("chroot: cannot execute %s: %s\n", | 64 | fatalError("cannot execute %s: %s\n", prog, strerror(errno)); |
66 | prog, strerror(errno)); | ||
67 | 65 | ||
68 | } | 66 | } |
69 | 67 | ||
diff --git a/coreutils/date.c b/coreutils/date.c index 9e8e3f3eb..bc6d13137 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -66,7 +66,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string) | |||
66 | &(tm_time->tm_min), &(tm_time->tm_year)); | 66 | &(tm_time->tm_min), &(tm_time->tm_year)); |
67 | 67 | ||
68 | if (nr < 4 || nr > 5) { | 68 | if (nr < 4 || nr > 5) { |
69 | fatalError(invalid_date, "date", t_string); | 69 | fatalError(invalid_date, t_string); |
70 | } | 70 | } |
71 | 71 | ||
72 | /* correct for century - minor Y2K problem here? */ | 72 | /* correct for century - minor Y2K problem here? */ |
@@ -150,7 +150,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) | |||
150 | 150 | ||
151 | } | 151 | } |
152 | 152 | ||
153 | fatalError(invalid_date, "date", t_string); | 153 | fatalError(invalid_date, t_string); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
@@ -186,7 +186,7 @@ int date_main(int argc, char **argv) | |||
186 | case 'u': | 186 | case 'u': |
187 | utc = 1; | 187 | utc = 1; |
188 | if (putenv("TZ=UTC0") != 0) | 188 | if (putenv("TZ=UTC0") != 0) |
189 | fatalError(memory_exhausted, "date"); | 189 | fatalError(memory_exhausted); |
190 | break; | 190 | break; |
191 | case 'd': | 191 | case 'd': |
192 | use_arg = 1; | 192 | use_arg = 1; |
@@ -236,12 +236,12 @@ int date_main(int argc, char **argv) | |||
236 | /* Correct any day of week and day of year etc fields */ | 236 | /* Correct any day of week and day of year etc fields */ |
237 | tm = mktime(&tm_time); | 237 | tm = mktime(&tm_time); |
238 | if (tm < 0) | 238 | if (tm < 0) |
239 | fatalError(invalid_date, "date", date_str); | 239 | fatalError(invalid_date, date_str); |
240 | 240 | ||
241 | /* if setting time, set it */ | 241 | /* if setting time, set it */ |
242 | if (set_time) { | 242 | if (set_time) { |
243 | if (stime(&tm) < 0) { | 243 | if (stime(&tm) < 0) { |
244 | fatalError("date: can't set date.\n"); | 244 | fatalError("can't set date.\n"); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c index f4a8b99d0..e6f1c86b4 100644 --- a/coreutils/md5sum.c +++ b/coreutils/md5sum.c | |||
@@ -708,13 +708,13 @@ static int md5_file(const char *filename, | |||
708 | } else { | 708 | } else { |
709 | fp = fopen(filename, OPENOPTS(binary)); | 709 | fp = fopen(filename, OPENOPTS(binary)); |
710 | if (fp == NULL) { | 710 | if (fp == NULL) { |
711 | errorMsg("md5sum: %s: %s\n", filename, strerror(errno)); | 711 | errorMsg("%s: %s\n", filename, strerror(errno)); |
712 | return FALSE; | 712 | return FALSE; |
713 | } | 713 | } |
714 | } | 714 | } |
715 | 715 | ||
716 | if (md5_stream(fp, md5_result)) { | 716 | if (md5_stream(fp, md5_result)) { |
717 | errorMsg("md5sum: %s: %s\n", filename, strerror(errno)); | 717 | errorMsg("%s: %s\n", filename, strerror(errno)); |
718 | 718 | ||
719 | if (fp != stdin) | 719 | if (fp != stdin) |
720 | fclose(fp); | 720 | fclose(fp); |
@@ -722,7 +722,7 @@ static int md5_file(const char *filename, | |||
722 | } | 722 | } |
723 | 723 | ||
724 | if (fp != stdin && fclose(fp) == EOF) { | 724 | if (fp != stdin && fclose(fp) == EOF) { |
725 | errorMsg("md5sum: %s: %s\n", filename, strerror(errno)); | 725 | errorMsg("%s: %s\n", filename, strerror(errno)); |
726 | return FALSE; | 726 | return FALSE; |
727 | } | 727 | } |
728 | 728 | ||
@@ -746,7 +746,7 @@ static int md5_check(const char *checkfile_name) | |||
746 | } else { | 746 | } else { |
747 | checkfile_stream = fopen(checkfile_name, "r"); | 747 | checkfile_stream = fopen(checkfile_name, "r"); |
748 | if (checkfile_stream == NULL) { | 748 | if (checkfile_stream == NULL) { |
749 | errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); | 749 | errorMsg("%s: %s\n", checkfile_name, strerror(errno)); |
750 | return FALSE; | 750 | return FALSE; |
751 | } | 751 | } |
752 | } | 752 | } |
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index 87553b3de..f0c923b7b 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
@@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv) | |||
31 | char buf[BUFSIZ + 1]; | 31 | char buf[BUFSIZ + 1]; |
32 | 32 | ||
33 | if (getcwd(buf, sizeof(buf)) == NULL) | 33 | if (getcwd(buf, sizeof(buf)) == NULL) |
34 | fatalError("pwd: %s\n", strerror(errno)); | 34 | fatalError("%s\n", strerror(errno)); |
35 | 35 | ||
36 | printf("%s\n", buf); | 36 | printf("%s\n", buf); |
37 | return(TRUE); | 37 | return(TRUE); |
diff --git a/coreutils/touch.c b/coreutils/touch.c index f52bb0284..ac275423c 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -70,12 +70,12 @@ extern int touch_main(int argc, char **argv) | |||
70 | if (create == FALSE && errno == ENOENT) | 70 | if (create == FALSE && errno == ENOENT) |
71 | exit(TRUE); | 71 | exit(TRUE); |
72 | else { | 72 | else { |
73 | fatalError("touch: %s", strerror(errno)); | 73 | fatalError("%s", strerror(errno)); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | close(fd); | 76 | close(fd); |
77 | if (utime(*argv, NULL)) { | 77 | if (utime(*argv, NULL)) { |
78 | fatalError("touch: %s", strerror(errno)); | 78 | fatalError("%s", strerror(errno)); |
79 | } | 79 | } |
80 | argc--; | 80 | argc--; |
81 | argv++; | 81 | argv++; |
diff --git a/coreutils/tr.c b/coreutils/tr.c index 5a8116db0..293bbce6b 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -189,7 +189,7 @@ extern int tr_main(int argc, char **argv) | |||
189 | complement(input); | 189 | complement(input); |
190 | if (argv[index] != NULL) { | 190 | if (argv[index] != NULL) { |
191 | if (*argv[index] == '\0') | 191 | if (*argv[index] == '\0') |
192 | fatalError("tr: STRING2 cannot be empty\n"); | 192 | fatalError("STRING2 cannot be empty\n"); |
193 | expand(argv[index], output); | 193 | expand(argv[index], output); |
194 | map(input, output); | 194 | map(input, output); |
195 | } | 195 | } |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index ac33762b0..12a71a573 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -286,7 +286,7 @@ static int decode (const char *inname, | |||
286 | && (freopen (outname, "w", stdout) == NULL | 286 | && (freopen (outname, "w", stdout) == NULL |
287 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) | 287 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) |
288 | )) { | 288 | )) { |
289 | errorMsg("uudeoce %s: %s %s\n", outname, inname, strerror(errno)); /* */ | 289 | errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ |
290 | return FALSE; | 290 | return FALSE; |
291 | } | 291 | } |
292 | 292 | ||
@@ -340,7 +340,7 @@ int uudecode_main (int argc, | |||
340 | if (decode (argv[optind], outname) != 0) | 340 | if (decode (argv[optind], outname) != 0) |
341 | exit_status = FALSE; | 341 | exit_status = FALSE; |
342 | } else { | 342 | } else { |
343 | errorMsg("uudecode: %s: %s\n", argv[optind], strerror(errno)); | 343 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); |
344 | exit_status = FALSE; | 344 | exit_status = FALSE; |
345 | } | 345 | } |
346 | optind++; | 346 | optind++; |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index e4fc1a0bc..e107a01e7 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -217,7 +217,7 @@ int uuencode_main (int argc, | |||
217 | case 2: | 217 | case 2: |
218 | /* Optional first argument is input file. */ | 218 | /* Optional first argument is input file. */ |
219 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { | 219 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { |
220 | errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno)); | 220 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); |
221 | exit FALSE; | 221 | exit FALSE; |
222 | } | 222 | } |
223 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); | 223 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |
@@ -66,7 +66,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string) | |||
66 | &(tm_time->tm_min), &(tm_time->tm_year)); | 66 | &(tm_time->tm_min), &(tm_time->tm_year)); |
67 | 67 | ||
68 | if (nr < 4 || nr > 5) { | 68 | if (nr < 4 || nr > 5) { |
69 | fatalError(invalid_date, "date", t_string); | 69 | fatalError(invalid_date, t_string); |
70 | } | 70 | } |
71 | 71 | ||
72 | /* correct for century - minor Y2K problem here? */ | 72 | /* correct for century - minor Y2K problem here? */ |
@@ -150,7 +150,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) | |||
150 | 150 | ||
151 | } | 151 | } |
152 | 152 | ||
153 | fatalError(invalid_date, "date", t_string); | 153 | fatalError(invalid_date, t_string); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
@@ -186,7 +186,7 @@ int date_main(int argc, char **argv) | |||
186 | case 'u': | 186 | case 'u': |
187 | utc = 1; | 187 | utc = 1; |
188 | if (putenv("TZ=UTC0") != 0) | 188 | if (putenv("TZ=UTC0") != 0) |
189 | fatalError(memory_exhausted, "date"); | 189 | fatalError(memory_exhausted); |
190 | break; | 190 | break; |
191 | case 'd': | 191 | case 'd': |
192 | use_arg = 1; | 192 | use_arg = 1; |
@@ -236,12 +236,12 @@ int date_main(int argc, char **argv) | |||
236 | /* Correct any day of week and day of year etc fields */ | 236 | /* Correct any day of week and day of year etc fields */ |
237 | tm = mktime(&tm_time); | 237 | tm = mktime(&tm_time); |
238 | if (tm < 0) | 238 | if (tm < 0) |
239 | fatalError(invalid_date, "date", date_str); | 239 | fatalError(invalid_date, date_str); |
240 | 240 | ||
241 | /* if setting time, set it */ | 241 | /* if setting time, set it */ |
242 | if (set_time) { | 242 | if (set_time) { |
243 | if (stime(&tm) < 0) { | 243 | if (stime(&tm) < 0) { |
244 | fatalError("date: can't set date.\n"); | 244 | fatalError("can't set date.\n"); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
diff --git a/editors/sed.c b/editors/sed.c index b6bfcdb68..9e4a002d8 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -196,7 +196,7 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
196 | else if (my_str[idx] == '/') { | 196 | else if (my_str[idx] == '/') { |
197 | idx = index_of_next_unescaped_slash(idx, my_str); | 197 | idx = index_of_next_unescaped_slash(idx, my_str); |
198 | if (idx == -1) | 198 | if (idx == -1) |
199 | fatalError("sed: unterminated match expression\n"); | 199 | fatalError("unterminated match expression\n"); |
200 | my_str[idx] = '\0'; | 200 | my_str[idx] = '\0'; |
201 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); | 201 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); |
202 | if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) { | 202 | 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) | |||
243 | 243 | ||
244 | /* last part (mandatory) will be a command */ | 244 | /* last part (mandatory) will be a command */ |
245 | if (cmdstr[idx] == '\0') | 245 | if (cmdstr[idx] == '\0') |
246 | fatalError("sed: missing command\n"); | 246 | fatalError("missing command\n"); |
247 | if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */ | 247 | if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */ |
248 | fatalError("sed: invalid command\n"); | 248 | fatalError("invalid command\n"); |
249 | sed_cmd->cmd = cmdstr[idx]; | 249 | sed_cmd->cmd = cmdstr[idx]; |
250 | /* special-case handling for 's' */ | 250 | /* special-case handling for 's' */ |
251 | if (sed_cmd->cmd == 's') { | 251 | if (sed_cmd->cmd == 's') { |
@@ -259,20 +259,20 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
259 | 259 | ||
260 | /* verify that we have an 's' followed by a 'slash' */ | 260 | /* verify that we have an 's' followed by a 'slash' */ |
261 | if (cmdstr[++idx] != '/') | 261 | if (cmdstr[++idx] != '/') |
262 | fatalError("sed: bad format in substitution expression\n"); | 262 | fatalError("bad format in substitution expression\n"); |
263 | 263 | ||
264 | /* save the match string */ | 264 | /* save the match string */ |
265 | oldidx = idx+1; | 265 | oldidx = idx+1; |
266 | idx = index_of_next_unescaped_slash(idx, cmdstr); | 266 | idx = index_of_next_unescaped_slash(idx, cmdstr); |
267 | if (idx == -1) | 267 | if (idx == -1) |
268 | fatalError("sed: bad format in substitution expression\n"); | 268 | fatalError("bad format in substitution expression\n"); |
269 | match = strdup_substr(cmdstr, oldidx, idx); | 269 | match = strdup_substr(cmdstr, oldidx, idx); |
270 | 270 | ||
271 | /* save the replacement string */ | 271 | /* save the replacement string */ |
272 | oldidx = idx+1; | 272 | oldidx = idx+1; |
273 | idx = index_of_next_unescaped_slash(idx, cmdstr); | 273 | idx = index_of_next_unescaped_slash(idx, cmdstr); |
274 | if (idx == -1) | 274 | if (idx == -1) |
275 | fatalError("sed: bad format in substitution expression\n"); | 275 | fatalError("bad format in substitution expression\n"); |
276 | sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx); | 276 | sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx); |
277 | 277 | ||
278 | /* process the flags */ | 278 | /* process the flags */ |
@@ -285,7 +285,7 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
285 | cflags |= REG_ICASE; | 285 | cflags |= REG_ICASE; |
286 | break; | 286 | break; |
287 | default: | 287 | default: |
288 | fatalError("sed: bad option in substitution expression\n"); | 288 | fatalError("bad option in substitution expression\n"); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
diff --git a/freeramdisk.c b/freeramdisk.c index a6fa2431f..927c16946 100644 --- a/freeramdisk.c +++ b/freeramdisk.c | |||
@@ -52,10 +52,10 @@ freeramdisk_main(int argc, char **argv) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | if ((f = open(argv[1], O_RDWR)) == -1) { | 54 | if ((f = open(argv[1], O_RDWR)) == -1) { |
55 | fatalError( "freeramdisk: cannot open %s: %s\n", argv[1], strerror(errno)); | 55 | fatalError( "cannot open %s: %s\n", argv[1], strerror(errno)); |
56 | } | 56 | } |
57 | if (ioctl(f, BLKFLSBUF) < 0) { | 57 | if (ioctl(f, BLKFLSBUF) < 0) { |
58 | fatalError( "freeramdisk: failed ioctl on %s: %s\n", argv[1], strerror(errno)); | 58 | fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno)); |
59 | } | 59 | } |
60 | /* Don't bother closing. Exit does | 60 | /* Don't bother closing. Exit does |
61 | * that, so we can save a few bytes */ | 61 | * that, so we can save a few bytes */ |
@@ -212,7 +212,7 @@ extern int method; /* compression method */ | |||
212 | # define DECLARE(type, array, size) type * array | 212 | # define DECLARE(type, array, size) type * array |
213 | # define ALLOC(type, array, size) { \ | 213 | # define ALLOC(type, array, size) { \ |
214 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 214 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
215 | if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \ | 215 | if (array == NULL) errorMsg(memory_exhausted); \ |
216 | } | 216 | } |
217 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 217 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
218 | #else | 218 | #else |
@@ -930,7 +930,7 @@ int in, out; /* input and output file descriptors */ | |||
930 | int res = inflate(); | 930 | int res = inflate(); |
931 | 931 | ||
932 | if (res == 3) { | 932 | if (res == 3) { |
933 | errorMsg(memory_exhausted, "gunzip"); | 933 | errorMsg(memory_exhausted); |
934 | } else if (res != 0) { | 934 | } else if (res != 0) { |
935 | errorMsg("invalid compressed data--format violated"); | 935 | errorMsg("invalid compressed data--format violated"); |
936 | } | 936 | } |
@@ -127,7 +127,7 @@ extern int method; /* compression method */ | |||
127 | # define DECLARE(type, array, size) type * array | 127 | # define DECLARE(type, array, size) type * array |
128 | # define ALLOC(type, array, size) { \ | 128 | # define ALLOC(type, array, size) { \ |
129 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 129 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
130 | if (array == NULL) errorMsg(memory_exhausted, "gzip"); \ | 130 | if (array == NULL) errorMsg(memory_exhausted); \ |
131 | } | 131 | } |
132 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 132 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
133 | #else | 133 | #else |
@@ -3251,7 +3251,7 @@ char *env; /* name of environment variable */ | |||
3251 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); | 3251 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); |
3252 | 3252 | ||
3253 | if (nargv == NULL) | 3253 | if (nargv == NULL) |
3254 | errorMsg(memory_exhausted, "gzip"); | 3254 | errorMsg(memory_exhausted); |
3255 | oargv = *argvp; | 3255 | oargv = *argvp; |
3256 | *argvp = nargv; | 3256 | *argvp = nargv; |
3257 | 3257 | ||
@@ -850,7 +850,7 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg) | |||
850 | #endif | 850 | #endif |
851 | 851 | ||
852 | execvp(newJob.progs[i].argv[0], newJob.progs[i].argv); | 852 | execvp(newJob.progs[i].argv[0], newJob.progs[i].argv); |
853 | fatalError("sh: %s: %s\n", newJob.progs[i].argv[0], | 853 | fatalError("%s: %s\n", newJob.progs[i].argv[0], |
854 | strerror(errno)); | 854 | strerror(errno)); |
855 | } | 855 | } |
856 | 856 | ||
@@ -1043,7 +1043,7 @@ int shell_main(int argc, char **argv) | |||
1043 | /* initialize the cwd */ | 1043 | /* initialize the cwd */ |
1044 | cwd = (char *) calloc(BUFSIZ, sizeof(char)); | 1044 | cwd = (char *) calloc(BUFSIZ, sizeof(char)); |
1045 | if (cwd == 0) { | 1045 | if (cwd == 0) { |
1046 | fatalError("sh: out of memory\n"); | 1046 | fatalError("out of memory\n"); |
1047 | } | 1047 | } |
1048 | getcwd(cwd, sizeof(char)*BUFSIZ); | 1048 | getcwd(cwd, sizeof(char)*BUFSIZ); |
1049 | 1049 | ||
@@ -1065,7 +1065,7 @@ int shell_main(int argc, char **argv) | |||
1065 | int i; | 1065 | int i; |
1066 | local_pending_command = (char *) calloc(BUFSIZ, sizeof(char)); | 1066 | local_pending_command = (char *) calloc(BUFSIZ, sizeof(char)); |
1067 | if (local_pending_command == 0) { | 1067 | if (local_pending_command == 0) { |
1068 | fatalError("sh: out of memory\n"); | 1068 | fatalError("out of memory\n"); |
1069 | } | 1069 | } |
1070 | for(i=2; i<argc; i++) | 1070 | for(i=2; i<argc; i++) |
1071 | { | 1071 | { |
@@ -1073,7 +1073,7 @@ int shell_main(int argc, char **argv) | |||
1073 | local_pending_command = realloc(local_pending_command, | 1073 | local_pending_command = realloc(local_pending_command, |
1074 | strlen(local_pending_command) + strlen(argv[i])); | 1074 | strlen(local_pending_command) + strlen(argv[i])); |
1075 | if (local_pending_command==NULL) | 1075 | if (local_pending_command==NULL) |
1076 | fatalError("sh: commands for -c option too long\n"); | 1076 | fatalError("commands for -c option too long\n"); |
1077 | } | 1077 | } |
1078 | strcat(local_pending_command, argv[i]); | 1078 | strcat(local_pending_command, argv[i]); |
1079 | if ( (i + 1) < argc) | 1079 | if ( (i + 1) < argc) |
@@ -1088,7 +1088,7 @@ int shell_main(int argc, char **argv) | |||
1088 | else { | 1088 | else { |
1089 | input = fopen(argv[1], "r"); | 1089 | input = fopen(argv[1], "r"); |
1090 | if (!input) { | 1090 | if (!input) { |
1091 | fatalError("sh: Couldn't open file '%s': %s\n", argv[1], | 1091 | fatalError("Couldn't open file '%s': %s\n", argv[1], |
1092 | strerror(errno)); | 1092 | strerror(errno)); |
1093 | } | 1093 | } |
1094 | } | 1094 | } |
@@ -708,13 +708,13 @@ static int md5_file(const char *filename, | |||
708 | } else { | 708 | } else { |
709 | fp = fopen(filename, OPENOPTS(binary)); | 709 | fp = fopen(filename, OPENOPTS(binary)); |
710 | if (fp == NULL) { | 710 | if (fp == NULL) { |
711 | errorMsg("md5sum: %s: %s\n", filename, strerror(errno)); | 711 | errorMsg("%s: %s\n", filename, strerror(errno)); |
712 | return FALSE; | 712 | return FALSE; |
713 | } | 713 | } |
714 | } | 714 | } |
715 | 715 | ||
716 | if (md5_stream(fp, md5_result)) { | 716 | if (md5_stream(fp, md5_result)) { |
717 | errorMsg("md5sum: %s: %s\n", filename, strerror(errno)); | 717 | errorMsg("%s: %s\n", filename, strerror(errno)); |
718 | 718 | ||
719 | if (fp != stdin) | 719 | if (fp != stdin) |
720 | fclose(fp); | 720 | fclose(fp); |
@@ -722,7 +722,7 @@ static int md5_file(const char *filename, | |||
722 | } | 722 | } |
723 | 723 | ||
724 | if (fp != stdin && fclose(fp) == EOF) { | 724 | if (fp != stdin && fclose(fp) == EOF) { |
725 | errorMsg("md5sum: %s: %s\n", filename, strerror(errno)); | 725 | errorMsg("%s: %s\n", filename, strerror(errno)); |
726 | return FALSE; | 726 | return FALSE; |
727 | } | 727 | } |
728 | 728 | ||
@@ -746,7 +746,7 @@ static int md5_check(const char *checkfile_name) | |||
746 | } else { | 746 | } else { |
747 | checkfile_stream = fopen(checkfile_name, "r"); | 747 | checkfile_stream = fopen(checkfile_name, "r"); |
748 | if (checkfile_stream == NULL) { | 748 | if (checkfile_stream == NULL) { |
749 | errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); | 749 | errorMsg("%s: %s\n", checkfile_name, strerror(errno)); |
750 | return FALSE; | 750 | return FALSE; |
751 | } | 751 | } |
752 | } | 752 | } |
diff --git a/messages.c b/messages.c index cb8de4077..f2374eeb5 100644 --- a/messages.c +++ b/messages.c | |||
@@ -57,10 +57,10 @@ | |||
57 | BB_DEF_MESSAGE(not_a_directory, "%s: %s: not a directory\n") | 57 | BB_DEF_MESSAGE(not_a_directory, "%s: %s: not a directory\n") |
58 | #endif | 58 | #endif |
59 | #if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN | 59 | #if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN |
60 | BB_DEF_MESSAGE(memory_exhausted, "%s: memory exhausted\n") | 60 | BB_DEF_MESSAGE(memory_exhausted, "memory exhausted\n") |
61 | #endif | 61 | #endif |
62 | #if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN | 62 | #if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN |
63 | BB_DEF_MESSAGE(invalid_date, "%s: invalid date `%s'\n") | 63 | BB_DEF_MESSAGE(invalid_date, "invalid date `%s'\n") |
64 | #endif | 64 | #endif |
65 | #if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN | 65 | #if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN |
66 | BB_DEF_MESSAGE(invalid_option, "%s: invalid option -- %c\n") | 66 | BB_DEF_MESSAGE(invalid_option, "%s: invalid option -- %c\n") |
@@ -193,7 +193,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | if (errno == EPERM) { | 195 | if (errno == EPERM) { |
196 | fatalError("mount: permission denied. Are you root?\n"); | 196 | fatalError("permission denied. Are you root?\n"); |
197 | } | 197 | } |
198 | 198 | ||
199 | return (FALSE); | 199 | return (FALSE); |
@@ -69,7 +69,7 @@ int nc_main(int argc, char **argv) | |||
69 | hostinfo = (struct hostent *) gethostbyname(*argv); | 69 | hostinfo = (struct hostent *) gethostbyname(*argv); |
70 | 70 | ||
71 | if (!hostinfo) { | 71 | if (!hostinfo) { |
72 | fatalError("nc: cannot resolve %s\n", *argv); | 72 | fatalError("cannot resolve %s\n", *argv); |
73 | } | 73 | } |
74 | 74 | ||
75 | address.sin_family = AF_INET; | 75 | address.sin_family = AF_INET; |
diff --git a/networking/nc.c b/networking/nc.c index a7e48d39b..b6afe6ffa 100644 --- a/networking/nc.c +++ b/networking/nc.c | |||
@@ -69,7 +69,7 @@ int nc_main(int argc, char **argv) | |||
69 | hostinfo = (struct hostent *) gethostbyname(*argv); | 69 | hostinfo = (struct hostent *) gethostbyname(*argv); |
70 | 70 | ||
71 | if (!hostinfo) { | 71 | if (!hostinfo) { |
72 | fatalError("nc: cannot resolve %s\n", *argv); | 72 | fatalError("cannot resolve %s\n", *argv); |
73 | } | 73 | } |
74 | 74 | ||
75 | address.sin_family = AF_INET; | 75 | address.sin_family = AF_INET; |
diff --git a/networking/ping.c b/networking/ping.c index c560a7ce2..0359abbd1 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $ | 3 | * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -336,7 +336,7 @@ static void sendping(int ign) | |||
336 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); | 336 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); |
337 | 337 | ||
338 | if (i < 0) | 338 | if (i < 0) |
339 | fatalError("ping: sendto: %s\n", strerror(errno)); | 339 | fatalError("sendto: %s\n", strerror(errno)); |
340 | else if (i != sizeof(packet)) | 340 | else if (i != sizeof(packet)) |
341 | fatalError("ping wrote %d chars; %d expected\n", i, | 341 | fatalError("ping wrote %d chars; %d expected\n", i, |
342 | (int)sizeof(packet)); | 342 | (int)sizeof(packet)); |
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $ | 3 | * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -336,7 +336,7 @@ static void sendping(int ign) | |||
336 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); | 336 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); |
337 | 337 | ||
338 | if (i < 0) | 338 | if (i < 0) |
339 | fatalError("ping: sendto: %s\n", strerror(errno)); | 339 | fatalError("sendto: %s\n", strerror(errno)); |
340 | else if (i != sizeof(packet)) | 340 | else if (i != sizeof(packet)) |
341 | fatalError("ping wrote %d chars; %d expected\n", i, | 341 | fatalError("ping wrote %d chars; %d expected\n", i, |
342 | (int)sizeof(packet)); | 342 | (int)sizeof(packet)); |
@@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv) | |||
31 | char buf[BUFSIZ + 1]; | 31 | char buf[BUFSIZ + 1]; |
32 | 32 | ||
33 | if (getcwd(buf, sizeof(buf)) == NULL) | 33 | if (getcwd(buf, sizeof(buf)) == NULL) |
34 | fatalError("pwd: %s\n", strerror(errno)); | 34 | fatalError("%s\n", strerror(errno)); |
35 | 35 | ||
36 | printf("%s\n", buf); | 36 | printf("%s\n", buf); |
37 | return(TRUE); | 37 | return(TRUE); |
@@ -196,7 +196,7 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
196 | else if (my_str[idx] == '/') { | 196 | else if (my_str[idx] == '/') { |
197 | idx = index_of_next_unescaped_slash(idx, my_str); | 197 | idx = index_of_next_unescaped_slash(idx, my_str); |
198 | if (idx == -1) | 198 | if (idx == -1) |
199 | fatalError("sed: unterminated match expression\n"); | 199 | fatalError("unterminated match expression\n"); |
200 | my_str[idx] = '\0'; | 200 | my_str[idx] = '\0'; |
201 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); | 201 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); |
202 | if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) { | 202 | 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) | |||
243 | 243 | ||
244 | /* last part (mandatory) will be a command */ | 244 | /* last part (mandatory) will be a command */ |
245 | if (cmdstr[idx] == '\0') | 245 | if (cmdstr[idx] == '\0') |
246 | fatalError("sed: missing command\n"); | 246 | fatalError("missing command\n"); |
247 | if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */ | 247 | if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */ |
248 | fatalError("sed: invalid command\n"); | 248 | fatalError("invalid command\n"); |
249 | sed_cmd->cmd = cmdstr[idx]; | 249 | sed_cmd->cmd = cmdstr[idx]; |
250 | /* special-case handling for 's' */ | 250 | /* special-case handling for 's' */ |
251 | if (sed_cmd->cmd == 's') { | 251 | if (sed_cmd->cmd == 's') { |
@@ -259,20 +259,20 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
259 | 259 | ||
260 | /* verify that we have an 's' followed by a 'slash' */ | 260 | /* verify that we have an 's' followed by a 'slash' */ |
261 | if (cmdstr[++idx] != '/') | 261 | if (cmdstr[++idx] != '/') |
262 | fatalError("sed: bad format in substitution expression\n"); | 262 | fatalError("bad format in substitution expression\n"); |
263 | 263 | ||
264 | /* save the match string */ | 264 | /* save the match string */ |
265 | oldidx = idx+1; | 265 | oldidx = idx+1; |
266 | idx = index_of_next_unescaped_slash(idx, cmdstr); | 266 | idx = index_of_next_unescaped_slash(idx, cmdstr); |
267 | if (idx == -1) | 267 | if (idx == -1) |
268 | fatalError("sed: bad format in substitution expression\n"); | 268 | fatalError("bad format in substitution expression\n"); |
269 | match = strdup_substr(cmdstr, oldidx, idx); | 269 | match = strdup_substr(cmdstr, oldidx, idx); |
270 | 270 | ||
271 | /* save the replacement string */ | 271 | /* save the replacement string */ |
272 | oldidx = idx+1; | 272 | oldidx = idx+1; |
273 | idx = index_of_next_unescaped_slash(idx, cmdstr); | 273 | idx = index_of_next_unescaped_slash(idx, cmdstr); |
274 | if (idx == -1) | 274 | if (idx == -1) |
275 | fatalError("sed: bad format in substitution expression\n"); | 275 | fatalError("bad format in substitution expression\n"); |
276 | sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx); | 276 | sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx); |
277 | 277 | ||
278 | /* process the flags */ | 278 | /* process the flags */ |
@@ -285,7 +285,7 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
285 | cflags |= REG_ICASE; | 285 | cflags |= REG_ICASE; |
286 | break; | 286 | break; |
287 | default: | 287 | default: |
288 | fatalError("sed: bad option in substitution expression\n"); | 288 | fatalError("bad option in substitution expression\n"); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
@@ -850,7 +850,7 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg) | |||
850 | #endif | 850 | #endif |
851 | 851 | ||
852 | execvp(newJob.progs[i].argv[0], newJob.progs[i].argv); | 852 | execvp(newJob.progs[i].argv[0], newJob.progs[i].argv); |
853 | fatalError("sh: %s: %s\n", newJob.progs[i].argv[0], | 853 | fatalError("%s: %s\n", newJob.progs[i].argv[0], |
854 | strerror(errno)); | 854 | strerror(errno)); |
855 | } | 855 | } |
856 | 856 | ||
@@ -1043,7 +1043,7 @@ int shell_main(int argc, char **argv) | |||
1043 | /* initialize the cwd */ | 1043 | /* initialize the cwd */ |
1044 | cwd = (char *) calloc(BUFSIZ, sizeof(char)); | 1044 | cwd = (char *) calloc(BUFSIZ, sizeof(char)); |
1045 | if (cwd == 0) { | 1045 | if (cwd == 0) { |
1046 | fatalError("sh: out of memory\n"); | 1046 | fatalError("out of memory\n"); |
1047 | } | 1047 | } |
1048 | getcwd(cwd, sizeof(char)*BUFSIZ); | 1048 | getcwd(cwd, sizeof(char)*BUFSIZ); |
1049 | 1049 | ||
@@ -1065,7 +1065,7 @@ int shell_main(int argc, char **argv) | |||
1065 | int i; | 1065 | int i; |
1066 | local_pending_command = (char *) calloc(BUFSIZ, sizeof(char)); | 1066 | local_pending_command = (char *) calloc(BUFSIZ, sizeof(char)); |
1067 | if (local_pending_command == 0) { | 1067 | if (local_pending_command == 0) { |
1068 | fatalError("sh: out of memory\n"); | 1068 | fatalError("out of memory\n"); |
1069 | } | 1069 | } |
1070 | for(i=2; i<argc; i++) | 1070 | for(i=2; i<argc; i++) |
1071 | { | 1071 | { |
@@ -1073,7 +1073,7 @@ int shell_main(int argc, char **argv) | |||
1073 | local_pending_command = realloc(local_pending_command, | 1073 | local_pending_command = realloc(local_pending_command, |
1074 | strlen(local_pending_command) + strlen(argv[i])); | 1074 | strlen(local_pending_command) + strlen(argv[i])); |
1075 | if (local_pending_command==NULL) | 1075 | if (local_pending_command==NULL) |
1076 | fatalError("sh: commands for -c option too long\n"); | 1076 | fatalError("commands for -c option too long\n"); |
1077 | } | 1077 | } |
1078 | strcat(local_pending_command, argv[i]); | 1078 | strcat(local_pending_command, argv[i]); |
1079 | if ( (i + 1) < argc) | 1079 | if ( (i + 1) < argc) |
@@ -1088,7 +1088,7 @@ int shell_main(int argc, char **argv) | |||
1088 | else { | 1088 | else { |
1089 | input = fopen(argv[1], "r"); | 1089 | input = fopen(argv[1], "r"); |
1090 | if (!input) { | 1090 | if (!input) { |
1091 | fatalError("sh: Couldn't open file '%s': %s\n", argv[1], | 1091 | fatalError("Couldn't open file '%s': %s\n", argv[1], |
1092 | strerror(errno)); | 1092 | strerror(errno)); |
1093 | } | 1093 | } |
1094 | } | 1094 | } |
diff --git a/shell/lash.c b/shell/lash.c index 60d67e9e8..4620ae3ce 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -850,7 +850,7 @@ static int runCommand(struct job newJob, struct jobSet *jobList, int inBg) | |||
850 | #endif | 850 | #endif |
851 | 851 | ||
852 | execvp(newJob.progs[i].argv[0], newJob.progs[i].argv); | 852 | execvp(newJob.progs[i].argv[0], newJob.progs[i].argv); |
853 | fatalError("sh: %s: %s\n", newJob.progs[i].argv[0], | 853 | fatalError("%s: %s\n", newJob.progs[i].argv[0], |
854 | strerror(errno)); | 854 | strerror(errno)); |
855 | } | 855 | } |
856 | 856 | ||
@@ -1043,7 +1043,7 @@ int shell_main(int argc, char **argv) | |||
1043 | /* initialize the cwd */ | 1043 | /* initialize the cwd */ |
1044 | cwd = (char *) calloc(BUFSIZ, sizeof(char)); | 1044 | cwd = (char *) calloc(BUFSIZ, sizeof(char)); |
1045 | if (cwd == 0) { | 1045 | if (cwd == 0) { |
1046 | fatalError("sh: out of memory\n"); | 1046 | fatalError("out of memory\n"); |
1047 | } | 1047 | } |
1048 | getcwd(cwd, sizeof(char)*BUFSIZ); | 1048 | getcwd(cwd, sizeof(char)*BUFSIZ); |
1049 | 1049 | ||
@@ -1065,7 +1065,7 @@ int shell_main(int argc, char **argv) | |||
1065 | int i; | 1065 | int i; |
1066 | local_pending_command = (char *) calloc(BUFSIZ, sizeof(char)); | 1066 | local_pending_command = (char *) calloc(BUFSIZ, sizeof(char)); |
1067 | if (local_pending_command == 0) { | 1067 | if (local_pending_command == 0) { |
1068 | fatalError("sh: out of memory\n"); | 1068 | fatalError("out of memory\n"); |
1069 | } | 1069 | } |
1070 | for(i=2; i<argc; i++) | 1070 | for(i=2; i<argc; i++) |
1071 | { | 1071 | { |
@@ -1073,7 +1073,7 @@ int shell_main(int argc, char **argv) | |||
1073 | local_pending_command = realloc(local_pending_command, | 1073 | local_pending_command = realloc(local_pending_command, |
1074 | strlen(local_pending_command) + strlen(argv[i])); | 1074 | strlen(local_pending_command) + strlen(argv[i])); |
1075 | if (local_pending_command==NULL) | 1075 | if (local_pending_command==NULL) |
1076 | fatalError("sh: commands for -c option too long\n"); | 1076 | fatalError("commands for -c option too long\n"); |
1077 | } | 1077 | } |
1078 | strcat(local_pending_command, argv[i]); | 1078 | strcat(local_pending_command, argv[i]); |
1079 | if ( (i + 1) < argc) | 1079 | if ( (i + 1) < argc) |
@@ -1088,7 +1088,7 @@ int shell_main(int argc, char **argv) | |||
1088 | else { | 1088 | else { |
1089 | input = fopen(argv[1], "r"); | 1089 | input = fopen(argv[1], "r"); |
1090 | if (!input) { | 1090 | if (!input) { |
1091 | fatalError("sh: Couldn't open file '%s': %s\n", argv[1], | 1091 | fatalError("Couldn't open file '%s': %s\n", argv[1], |
1092 | strerror(errno)); | 1092 | strerror(errno)); |
1093 | } | 1093 | } |
1094 | } | 1094 | } |
@@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
330 | } | 330 | } |
331 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { | 331 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { |
332 | /* Tarball seems to have a problem */ | 332 | /* Tarball seems to have a problem */ |
333 | errorMsg("tar: Unexpected EOF in archive\n"); | 333 | errorMsg("Unexpected EOF in archive\n"); |
334 | return( FALSE); | 334 | return( FALSE); |
335 | } | 335 | } |
336 | if ( readSize < writeSize ) | 336 | if ( readSize < writeSize ) |
@@ -368,7 +368,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
368 | return( TRUE); | 368 | return( TRUE); |
369 | 369 | ||
370 | if (createPath(header->name, header->mode) != TRUE) { | 370 | if (createPath(header->name, header->mode) != TRUE) { |
371 | errorMsg("tar: %s: Cannot mkdir: %s\n", | 371 | errorMsg("%s: Cannot mkdir: %s\n", |
372 | header->name, strerror(errno)); | 372 | header->name, strerror(errno)); |
373 | return( FALSE); | 373 | return( FALSE); |
374 | } | 374 | } |
@@ -388,7 +388,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
388 | return( TRUE); | 388 | return( TRUE); |
389 | 389 | ||
390 | if (link(header->linkname, header->name) < 0) { | 390 | if (link(header->linkname, header->name) < 0) { |
391 | errorMsg("tar: %s: Cannot create hard link to '%s': %s\n", | 391 | errorMsg("%s: Cannot create hard link to '%s': %s\n", |
392 | header->name, header->linkname, strerror(errno)); | 392 | header->name, header->linkname, strerror(errno)); |
393 | return( FALSE); | 393 | return( FALSE); |
394 | } | 394 | } |
@@ -406,7 +406,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
406 | 406 | ||
407 | #ifdef S_ISLNK | 407 | #ifdef S_ISLNK |
408 | if (symlink(header->linkname, header->name) < 0) { | 408 | if (symlink(header->linkname, header->name) < 0) { |
409 | errorMsg("tar: %s: Cannot create symlink to '%s': %s\n", | 409 | errorMsg("%s: Cannot create symlink to '%s': %s\n", |
410 | header->name, header->linkname, strerror(errno)); | 410 | header->name, header->linkname, strerror(errno)); |
411 | return( FALSE); | 411 | return( FALSE); |
412 | } | 412 | } |
@@ -421,7 +421,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
421 | /* Do not change permissions or date on symlink, | 421 | /* Do not change permissions or date on symlink, |
422 | * since it changes the pointed to file instead. duh. */ | 422 | * since it changes the pointed to file instead. duh. */ |
423 | #else | 423 | #else |
424 | errorMsg("tar: %s: Cannot create symlink to '%s': %s\n", | 424 | errorMsg("%s: Cannot create symlink to '%s': %s\n", |
425 | header->name, header->linkname, | 425 | header->name, header->linkname, |
426 | "symlinks not supported"); | 426 | "symlinks not supported"); |
427 | #endif | 427 | #endif |
@@ -436,13 +436,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
436 | 436 | ||
437 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { | 437 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { |
438 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { | 438 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { |
439 | errorMsg("tar: %s: Cannot mknod: %s\n", | 439 | errorMsg("%s: Cannot mknod: %s\n", |
440 | header->name, strerror(errno)); | 440 | header->name, strerror(errno)); |
441 | return( FALSE); | 441 | return( FALSE); |
442 | } | 442 | } |
443 | } else if (S_ISFIFO(header->mode)) { | 443 | } else if (S_ISFIFO(header->mode)) { |
444 | if (mkfifo(header->name, header->mode) < 0) { | 444 | if (mkfifo(header->name, header->mode) < 0) { |
445 | errorMsg("tar: %s: Cannot mkfifo: %s\n", | 445 | errorMsg("%s: Cannot mkfifo: %s\n", |
446 | header->name, strerror(errno)); | 446 | header->name, strerror(errno)); |
447 | return( FALSE); | 447 | return( FALSE); |
448 | } | 448 | } |
@@ -490,7 +490,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) | |||
490 | ++*(header->name); | 490 | ++*(header->name); |
491 | 491 | ||
492 | if (alreadyWarned == FALSE) { | 492 | if (alreadyWarned == FALSE) { |
493 | errorMsg("tar: Removing leading '/' from member names\n"); | 493 | errorMsg("Removing leading '/' from member names\n"); |
494 | alreadyWarned = TRUE; | 494 | alreadyWarned = TRUE; |
495 | } | 495 | } |
496 | } | 496 | } |
@@ -695,7 +695,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
695 | return ( FALSE); | 695 | return ( FALSE); |
696 | } | 696 | } |
697 | else if (errorFlag==TRUE) { | 697 | else if (errorFlag==TRUE) { |
698 | errorMsg( "tar: Error exit delayed from previous errors\n"); | 698 | errorMsg( "Error exit delayed from previous errors\n"); |
699 | return( FALSE); | 699 | return( FALSE); |
700 | } else | 700 | } else |
701 | return( status); | 701 | return( status); |
@@ -705,7 +705,7 @@ endgame: | |||
705 | close( tarFd); | 705 | close( tarFd); |
706 | if ( *(header.name) == '\0' ) { | 706 | if ( *(header.name) == '\0' ) { |
707 | if (errorFlag==TRUE) | 707 | if (errorFlag==TRUE) |
708 | errorMsg( "tar: Error exit delayed from previous errors\n"); | 708 | errorMsg( "Error exit delayed from previous errors\n"); |
709 | else | 709 | else |
710 | return( TRUE); | 710 | return( TRUE); |
711 | } | 711 | } |
@@ -782,7 +782,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
782 | if (*fileName=='/') { | 782 | if (*fileName=='/') { |
783 | static int alreadyWarned=FALSE; | 783 | static int alreadyWarned=FALSE; |
784 | if (alreadyWarned==FALSE) { | 784 | if (alreadyWarned==FALSE) { |
785 | errorMsg("tar: Removing leading '/' from member names\n"); | 785 | errorMsg("Removing leading '/' from member names\n"); |
786 | alreadyWarned=TRUE; | 786 | alreadyWarned=TRUE; |
787 | } | 787 | } |
788 | strncpy(header.name, fileName+1, sizeof(header.name)); | 788 | strncpy(header.name, fileName+1, sizeof(header.name)); |
@@ -854,7 +854,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
854 | header.typeflag = REGTYPE; | 854 | header.typeflag = REGTYPE; |
855 | putOctal(header.size, sizeof(header.size), statbuf->st_size); | 855 | putOctal(header.size, sizeof(header.size), statbuf->st_size); |
856 | } else { | 856 | } else { |
857 | errorMsg("tar: %s: Unknown file type\n", fileName); | 857 | errorMsg("%s: Unknown file type\n", fileName); |
858 | return ( FALSE); | 858 | return ( FALSE); |
859 | } | 859 | } |
860 | 860 | ||
@@ -892,7 +892,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
892 | 892 | ||
893 | /* It is against the rules to archive a socket */ | 893 | /* It is against the rules to archive a socket */ |
894 | if (S_ISSOCK(statbuf->st_mode)) { | 894 | if (S_ISSOCK(statbuf->st_mode)) { |
895 | errorMsg("tar: %s: socket ignored\n", fileName); | 895 | errorMsg("%s: socket ignored\n", fileName); |
896 | return( TRUE); | 896 | return( TRUE); |
897 | } | 897 | } |
898 | 898 | ||
@@ -901,7 +901,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
901 | * the new tarball */ | 901 | * the new tarball */ |
902 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && | 902 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && |
903 | tbInfo->statBuf.st_ino == statbuf->st_ino) { | 903 | tbInfo->statBuf.st_ino == statbuf->st_ino) { |
904 | errorMsg("tar: %s: file is the archive; skipping\n", fileName); | 904 | errorMsg("%s: file is the archive; skipping\n", fileName); |
905 | return( TRUE); | 905 | return( TRUE); |
906 | } | 906 | } |
907 | 907 | ||
@@ -917,7 +917,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
917 | 917 | ||
918 | /* open the file we want to archive, and make sure all is well */ | 918 | /* open the file we want to archive, and make sure all is well */ |
919 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { | 919 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { |
920 | errorMsg("tar: %s: Cannot open: %s\n", fileName, strerror(errno)); | 920 | errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno)); |
921 | return( FALSE); | 921 | return( FALSE); |
922 | } | 922 | } |
923 | 923 | ||
@@ -955,7 +955,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
955 | 955 | ||
956 | /* Make sure there is at least one file to tar up. */ | 956 | /* Make sure there is at least one file to tar up. */ |
957 | if (argc <= 0) | 957 | if (argc <= 0) |
958 | fatalError("tar: Cowardly refusing to create an empty archive\n"); | 958 | fatalError("Cowardly refusing to create an empty archive\n"); |
959 | 959 | ||
960 | /* Open the tar file for writing. */ | 960 | /* Open the tar file for writing. */ |
961 | if (tostdoutFlag == TRUE) | 961 | if (tostdoutFlag == TRUE) |
@@ -963,7 +963,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
963 | else | 963 | else |
964 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); | 964 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
965 | if (tbInfo.tarFd < 0) { | 965 | if (tbInfo.tarFd < 0) { |
966 | errorMsg( "tar: Error opening '%s': %s\n", tarName, strerror(errno)); | 966 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
967 | return ( FALSE); | 967 | return ( FALSE); |
968 | } | 968 | } |
969 | tbInfo.excludeList=excludeList; | 969 | tbInfo.excludeList=excludeList; |
@@ -997,7 +997,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
997 | /* Hang up the tools, close up shop, head home */ | 997 | /* Hang up the tools, close up shop, head home */ |
998 | close(tarFd); | 998 | close(tarFd); |
999 | if (errorFlag == TRUE) { | 999 | if (errorFlag == TRUE) { |
1000 | errorMsg("tar: Error exit delayed from previous errors\n"); | 1000 | errorMsg("Error exit delayed from previous errors\n"); |
1001 | return(FALSE); | 1001 | return(FALSE); |
1002 | } | 1002 | } |
1003 | return( TRUE); | 1003 | return( TRUE); |
@@ -70,12 +70,12 @@ extern int touch_main(int argc, char **argv) | |||
70 | if (create == FALSE && errno == ENOENT) | 70 | if (create == FALSE && errno == ENOENT) |
71 | exit(TRUE); | 71 | exit(TRUE); |
72 | else { | 72 | else { |
73 | fatalError("touch: %s", strerror(errno)); | 73 | fatalError("%s", strerror(errno)); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | close(fd); | 76 | close(fd); |
77 | if (utime(*argv, NULL)) { | 77 | if (utime(*argv, NULL)) { |
78 | fatalError("touch: %s", strerror(errno)); | 78 | fatalError("%s", strerror(errno)); |
79 | } | 79 | } |
80 | argc--; | 80 | argc--; |
81 | argv++; | 81 | argv++; |
@@ -189,7 +189,7 @@ extern int tr_main(int argc, char **argv) | |||
189 | complement(input); | 189 | complement(input); |
190 | if (argv[index] != NULL) { | 190 | if (argv[index] != NULL) { |
191 | if (*argv[index] == '\0') | 191 | if (*argv[index] == '\0') |
192 | fatalError("tr: STRING2 cannot be empty\n"); | 192 | fatalError("STRING2 cannot be empty\n"); |
193 | expand(argv[index], output); | 193 | expand(argv[index], output); |
194 | map(input, output); | 194 | map(input, output); |
195 | } | 195 | } |
@@ -201,7 +201,7 @@ static int do_umount(const char *name, int useMtab) | |||
201 | if (status != 0 && doForce == TRUE) { | 201 | if (status != 0 && doForce == TRUE) { |
202 | status = umount2(blockDevice, MNT_FORCE); | 202 | status = umount2(blockDevice, MNT_FORCE); |
203 | if (status != 0) { | 203 | if (status != 0) { |
204 | fatalError("umount: forced umount of %s failed!\n", blockDevice); | 204 | fatalError("forced umount of %s failed!\n", blockDevice); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | #endif | 207 | #endif |
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index a6fa2431f..927c16946 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c | |||
@@ -52,10 +52,10 @@ freeramdisk_main(int argc, char **argv) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | if ((f = open(argv[1], O_RDWR)) == -1) { | 54 | if ((f = open(argv[1], O_RDWR)) == -1) { |
55 | fatalError( "freeramdisk: cannot open %s: %s\n", argv[1], strerror(errno)); | 55 | fatalError( "cannot open %s: %s\n", argv[1], strerror(errno)); |
56 | } | 56 | } |
57 | if (ioctl(f, BLKFLSBUF) < 0) { | 57 | if (ioctl(f, BLKFLSBUF) < 0) { |
58 | fatalError( "freeramdisk: failed ioctl on %s: %s\n", argv[1], strerror(errno)); | 58 | fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno)); |
59 | } | 59 | } |
60 | /* Don't bother closing. Exit does | 60 | /* Don't bother closing. Exit does |
61 | * that, so we can save a few bytes */ | 61 | * that, so we can save a few bytes */ |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 66599a618..900ab30a7 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -193,7 +193,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | if (errno == EPERM) { | 195 | if (errno == EPERM) { |
196 | fatalError("mount: permission denied. Are you root?\n"); | 196 | fatalError("permission denied. Are you root?\n"); |
197 | } | 197 | } |
198 | 198 | ||
199 | return (FALSE); | 199 | return (FALSE); |
diff --git a/util-linux/umount.c b/util-linux/umount.c index fc9b466c6..59dcb6651 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -201,7 +201,7 @@ static int do_umount(const char *name, int useMtab) | |||
201 | if (status != 0 && doForce == TRUE) { | 201 | if (status != 0 && doForce == TRUE) { |
202 | status = umount2(blockDevice, MNT_FORCE); | 202 | status = umount2(blockDevice, MNT_FORCE); |
203 | if (status != 0) { | 203 | if (status != 0) { |
204 | fatalError("umount: forced umount of %s failed!\n", blockDevice); | 204 | fatalError("forced umount of %s failed!\n", blockDevice); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | #endif | 207 | #endif |
@@ -94,6 +94,7 @@ extern void errorMsg(const char *s, ...) | |||
94 | 94 | ||
95 | va_start(p, s); | 95 | va_start(p, s); |
96 | fflush(stdout); | 96 | fflush(stdout); |
97 | fprintf(stderr, "%s: ", applet_name); | ||
97 | vfprintf(stderr, s, p); | 98 | vfprintf(stderr, s, p); |
98 | va_end(p); | 99 | va_end(p); |
99 | fflush(stderr); | 100 | fflush(stderr); |
@@ -105,6 +106,7 @@ extern void fatalError(const char *s, ...) | |||
105 | 106 | ||
106 | va_start(p, s); | 107 | va_start(p, s); |
107 | fflush(stdout); | 108 | fflush(stdout); |
109 | fprintf(stderr, "%s: ", applet_name); | ||
108 | vfprintf(stderr, s, p); | 110 | vfprintf(stderr, s, p); |
109 | va_end(p); | 111 | va_end(p); |
110 | fflush(stderr); | 112 | fflush(stderr); |
@@ -1360,7 +1362,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1360 | && (strlen(pidName) == strlen(info.command_line))) { | 1362 | && (strlen(pidName) == strlen(info.command_line))) { |
1361 | pidList=realloc( pidList, sizeof(pid_t) * (j+2)); | 1363 | pidList=realloc( pidList, sizeof(pid_t) * (j+2)); |
1362 | if (pidList==NULL) | 1364 | if (pidList==NULL) |
1363 | fatalError(memory_exhausted, ""); | 1365 | fatalError(memory_exhausted); |
1364 | pidList[j++]=info.pid; | 1366 | pidList[j++]=info.pid; |
1365 | } | 1367 | } |
1366 | } | 1368 | } |
@@ -1433,7 +1435,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1433 | && (strlen(pidName) == strlen(p))) { | 1435 | && (strlen(pidName) == strlen(p))) { |
1434 | pidList=realloc( pidList, sizeof(pid_t) * (i+2)); | 1436 | pidList=realloc( pidList, sizeof(pid_t) * (i+2)); |
1435 | if (pidList==NULL) | 1437 | if (pidList==NULL) |
1436 | fatalError(memory_exhausted, ""); | 1438 | fatalError(memory_exhausted); |
1437 | pidList[i++]=strtol(next->d_name, NULL, 0); | 1439 | pidList[i++]=strtol(next->d_name, NULL, 0); |
1438 | } | 1440 | } |
1439 | } | 1441 | } |
@@ -1450,7 +1452,7 @@ extern void *xmalloc(size_t size) | |||
1450 | void *cp = malloc(size); | 1452 | void *cp = malloc(size); |
1451 | 1453 | ||
1452 | if (cp == NULL) | 1454 | if (cp == NULL) |
1453 | fatalError(memory_exhausted, ""); | 1455 | fatalError(memory_exhausted); |
1454 | return cp; | 1456 | return cp; |
1455 | } | 1457 | } |
1456 | 1458 | ||
@@ -1464,7 +1466,7 @@ extern char * xstrdup (const char *s) { | |||
1464 | t = strdup (s); | 1466 | t = strdup (s); |
1465 | 1467 | ||
1466 | if (t == NULL) | 1468 | if (t == NULL) |
1467 | fatalError(memory_exhausted, ""); | 1469 | fatalError(memory_exhausted); |
1468 | 1470 | ||
1469 | return t; | 1471 | return t; |
1470 | } | 1472 | } |
diff --git a/uudecode.c b/uudecode.c index ac33762b0..12a71a573 100644 --- a/uudecode.c +++ b/uudecode.c | |||
@@ -286,7 +286,7 @@ static int decode (const char *inname, | |||
286 | && (freopen (outname, "w", stdout) == NULL | 286 | && (freopen (outname, "w", stdout) == NULL |
287 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) | 287 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) |
288 | )) { | 288 | )) { |
289 | errorMsg("uudeoce %s: %s %s\n", outname, inname, strerror(errno)); /* */ | 289 | errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ |
290 | return FALSE; | 290 | return FALSE; |
291 | } | 291 | } |
292 | 292 | ||
@@ -340,7 +340,7 @@ int uudecode_main (int argc, | |||
340 | if (decode (argv[optind], outname) != 0) | 340 | if (decode (argv[optind], outname) != 0) |
341 | exit_status = FALSE; | 341 | exit_status = FALSE; |
342 | } else { | 342 | } else { |
343 | errorMsg("uudecode: %s: %s\n", argv[optind], strerror(errno)); | 343 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); |
344 | exit_status = FALSE; | 344 | exit_status = FALSE; |
345 | } | 345 | } |
346 | optind++; | 346 | optind++; |
diff --git a/uuencode.c b/uuencode.c index e4fc1a0bc..e107a01e7 100644 --- a/uuencode.c +++ b/uuencode.c | |||
@@ -217,7 +217,7 @@ int uuencode_main (int argc, | |||
217 | case 2: | 217 | case 2: |
218 | /* Optional first argument is input file. */ | 218 | /* Optional first argument is input file. */ |
219 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { | 219 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { |
220 | errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno)); | 220 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); |
221 | exit FALSE; | 221 | exit FALSE; |
222 | } | 222 | } |
223 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); | 223 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |