Change calls to error_msg.* and strerror to use perror_msg.*.
This commit is contained in:
parent
0dab829977
commit
1fa1adea2a
@ -54,7 +54,7 @@ static char *busybox_fullpath()
|
||||
if (len != -1) {
|
||||
path[len] = 0;
|
||||
} else {
|
||||
error_msg("%s: %s\n", proc, strerror(errno));
|
||||
perror_msg("%s", proc);
|
||||
return NULL;
|
||||
}
|
||||
return strdup(path);
|
||||
@ -78,7 +78,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
|
||||
rc = Link(busybox, command);
|
||||
|
||||
if (rc) {
|
||||
error_msg("%s: %s\n", command, strerror(errno));
|
||||
perror_msg("%s", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ extern int tar_main(int argc, char **argv)
|
||||
else
|
||||
tarFd = open(tarName, O_RDONLY);
|
||||
if (tarFd < 0)
|
||||
error_msg_and_die( "Error opening '%s': %s\n", tarName, strerror(errno));
|
||||
perror_msg_and_die("Error opening '%s'", tarName);
|
||||
|
||||
#ifdef BB_FEATURE_TAR_GZIP
|
||||
/* unzip tarFd in a seperate process */
|
||||
@ -425,8 +425,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
return( TRUE);
|
||||
|
||||
if (create_path(header->name, header->mode) != TRUE) {
|
||||
error_msg("%s: Cannot mkdir: %s\n",
|
||||
header->name, strerror(errno));
|
||||
perror_msg("%s: Cannot mkdir", header->name);
|
||||
return( FALSE);
|
||||
}
|
||||
/* make the final component, just in case it was
|
||||
@ -445,8 +444,8 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
return( TRUE);
|
||||
|
||||
if (link(header->linkname, header->name) < 0) {
|
||||
error_msg("%s: Cannot create hard link to '%s': %s\n",
|
||||
header->name, header->linkname, strerror(errno));
|
||||
perror_msg("%s: Cannot create hard link to '%s'", header->name,
|
||||
header->linkname);
|
||||
return( FALSE);
|
||||
}
|
||||
|
||||
@ -463,8 +462,8 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
|
||||
#ifdef S_ISLNK
|
||||
if (symlink(header->linkname, header->name) < 0) {
|
||||
error_msg("%s: Cannot create symlink to '%s': %s\n",
|
||||
header->name, header->linkname, strerror(errno));
|
||||
perror_msg("%s: Cannot create symlink to '%s'", header->name,
|
||||
header->linkname);
|
||||
return( FALSE);
|
||||
}
|
||||
/* Try to change ownership of the symlink.
|
||||
@ -493,14 +492,12 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
|
||||
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) {
|
||||
error_msg("%s: Cannot mknod: %s\n",
|
||||
header->name, strerror(errno));
|
||||
perror_msg("%s: Cannot mknod", header->name);
|
||||
return( FALSE);
|
||||
}
|
||||
} else if (S_ISFIFO(header->mode)) {
|
||||
if (mkfifo(header->name, header->mode) < 0) {
|
||||
error_msg("%s: Cannot mkfifo: %s\n",
|
||||
header->name, strerror(errno));
|
||||
perror_msg("%s: Cannot mkfifo", header->name);
|
||||
return( FALSE);
|
||||
}
|
||||
}
|
||||
@ -790,7 +787,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
||||
close(tarFd);
|
||||
if (status > 0) {
|
||||
/* Bummer - we read a partial header */
|
||||
error_msg( "Error reading tar file: %s\n", strerror(errno));
|
||||
perror_msg("Error reading tar file");
|
||||
return ( FALSE);
|
||||
}
|
||||
else if (errorFlag==TRUE) {
|
||||
@ -1007,7 +1004,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
|
||||
header.typeflag = SYMTYPE;
|
||||
link_size = readlink(fileName, buffer, sizeof(buffer) - 1);
|
||||
if ( link_size < 0) {
|
||||
error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
|
||||
perror_msg("Error reading symlink '%s'", header.name);
|
||||
return ( FALSE);
|
||||
}
|
||||
buffer[link_size] = '\0';
|
||||
@ -1165,7 +1162,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
|
||||
else
|
||||
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (tbInfo.tarFd < 0) {
|
||||
error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
|
||||
perror_msg( "Error opening '%s'", tarName);
|
||||
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
||||
return ( FALSE);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ static char *busybox_fullpath()
|
||||
if (len != -1) {
|
||||
path[len] = 0;
|
||||
} else {
|
||||
error_msg("%s: %s\n", proc, strerror(errno));
|
||||
perror_msg("%s", proc);
|
||||
return NULL;
|
||||
}
|
||||
return strdup(path);
|
||||
@ -78,7 +78,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
|
||||
rc = Link(busybox, command);
|
||||
|
||||
if (rc) {
|
||||
error_msg("%s: %s\n", command, strerror(errno));
|
||||
perror_msg("%s", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
chroot.c
4
chroot.c
@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv)
|
||||
argv++;
|
||||
|
||||
if (chroot(*argv) || (chdir("/"))) {
|
||||
error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno));
|
||||
perror_msg_and_die("cannot change root directory to %s", *argv);
|
||||
}
|
||||
|
||||
argc--;
|
||||
@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv)
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno));
|
||||
perror_msg_and_die("cannot execute %s", prog);
|
||||
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ int dumpkmap_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
error_msg("Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
perror_msg("Error opening /dev/tty0");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -39,13 +39,11 @@ int loadacm_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
if (fd < 0) {
|
||||
error_msg("Error opening /dev/tty1: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
perror_msg_and_die("Error opening /dev/tty1");
|
||||
}
|
||||
|
||||
if (screen_map_load(fd, stdin)) {
|
||||
error_msg("Error loading acm: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
perror_msg_and_die("Error loading acm");
|
||||
}
|
||||
|
||||
write(fd, "\033(K", 3);
|
||||
|
@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv)
|
||||
argv++;
|
||||
|
||||
if (chroot(*argv) || (chdir("/"))) {
|
||||
error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno));
|
||||
perror_msg_and_die("cannot change root directory to %s", *argv);
|
||||
}
|
||||
|
||||
argc--;
|
||||
@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv)
|
||||
return EXIT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno));
|
||||
perror_msg_and_die("cannot execute %s", prog);
|
||||
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ extern int cut_main(int argc, char **argv)
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
error_msg("%s: %s\n", argv[i], strerror(errno));
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
cut_file(file);
|
||||
fclose(file);
|
||||
|
@ -80,7 +80,7 @@ int head_main(int argc, char **argv)
|
||||
}
|
||||
head(len, fp);
|
||||
if (errno) {
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
perror_msg("%s", argv[optind]);
|
||||
status = EXIT_FAILURE;
|
||||
errno = 0;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ static int my_stat(struct dnode *cur)
|
||||
#ifdef BB_FEATURE_LS_FOLLOWLINKS
|
||||
if (follow_links == TRUE) {
|
||||
if (stat(cur->fullname, &cur->dstat)) {
|
||||
error_msg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
perror_msg("%s", cur->fullname);
|
||||
status = EXIT_FAILURE;
|
||||
free(cur->fullname);
|
||||
free(cur);
|
||||
@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur)
|
||||
} else
|
||||
#endif
|
||||
if (lstat(cur->fullname, &cur->dstat)) {
|
||||
error_msg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
perror_msg("%s", cur->fullname);
|
||||
status = EXIT_FAILURE;
|
||||
free(cur->fullname);
|
||||
free(cur);
|
||||
@ -511,7 +511,7 @@ struct dnode **list_dir(char *path)
|
||||
nfiles= 0;
|
||||
dir = opendir(path);
|
||||
if (dir == NULL) {
|
||||
error_msg("%s: %s\n", path, strerror(errno));
|
||||
perror_msg("%s", path);
|
||||
status = EXIT_FAILURE;
|
||||
return(NULL); /* could not open the dir */
|
||||
}
|
||||
|
@ -651,13 +651,13 @@ static int md5_file(const char *filename,
|
||||
} else {
|
||||
fp = fopen(filename, OPENOPTS(binary));
|
||||
if (fp == NULL) {
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
perror_msg("%s", filename);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (md5_stream(fp, md5_result)) {
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
perror_msg("%s", filename);
|
||||
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
@ -665,7 +665,7 @@ static int md5_file(const char *filename,
|
||||
}
|
||||
|
||||
if (fp != stdin && fclose(fp) == EOF) {
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
perror_msg("%s", filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name)
|
||||
} else {
|
||||
checkfile_stream = fopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL) {
|
||||
error_msg("%s: %s\n", checkfile_name, strerror(errno));
|
||||
perror_msg("%s", checkfile_name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name)
|
||||
}
|
||||
|
||||
if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) {
|
||||
error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
|
||||
perror_msg("md5sum: %s", checkfile_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@ extern int pwd_main(int argc, char **argv)
|
||||
char buf[BUFSIZ + 1];
|
||||
|
||||
if (getcwd(buf, sizeof(buf)) == NULL)
|
||||
error_msg_and_die("%s\n", strerror(errno));
|
||||
perror_msg_and_die("getcwd");
|
||||
|
||||
printf("%s\n", buf);
|
||||
puts(buf);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ tee_main(int argc, char **argv)
|
||||
while (optind < argc) {
|
||||
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
|
||||
nfiles--;
|
||||
error_msg("%s: %s\n", argv[optind-1], strerror(errno));
|
||||
perror_msg("%s", argv[optind-1]);
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ static int decode (const char *inname,
|
||||
&& (freopen (outname, "w", stdout) == NULL
|
||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||
)) {
|
||||
error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||
perror_msg("%s", outname); /* */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ int uudecode_main (int argc,
|
||||
if (decode (argv[optind], outname) != 0)
|
||||
exit_status = FALSE;
|
||||
} else {
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
perror_msg("%s", argv[optind]);
|
||||
exit_status = EXIT_FAILURE;
|
||||
}
|
||||
optind++;
|
||||
|
@ -160,15 +160,12 @@ int uuencode_main (int argc,
|
||||
trans_ptr = uu_std; /* Standard encoding is old uu format */
|
||||
|
||||
/* Parse any options */
|
||||
while ((opt = getopt (argc, argv, "m")) != EOF) {
|
||||
while ((opt = getopt (argc, argv, "m")) > 0) {
|
||||
switch (opt) {
|
||||
case 'm':
|
||||
trans_ptr = uu_base64;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(uuencode_usage);
|
||||
}
|
||||
@ -178,7 +175,7 @@ int uuencode_main (int argc,
|
||||
case 2:
|
||||
/* Optional first argument is input file. */
|
||||
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
perror_msg("%s", argv[optind]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
19
cp_mv.c
19
cp_mv.c
@ -130,8 +130,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
|
||||
if (mv_Action_first_time && (dz_i == is_mv)) {
|
||||
mv_Action_first_time = errno = 0;
|
||||
if (rename(fileName, destName) < 0 && errno != EXDEV) {
|
||||
error_msg("rename(%s, %s): %s\n", fileName, destName,
|
||||
strerror(errno));
|
||||
perror_msg("rename(%s, %s)", fileName, destName);
|
||||
goto do_copyFile; /* Try anyway... */
|
||||
}
|
||||
else if (errno == EXDEV)
|
||||
@ -143,7 +142,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
|
||||
if (preserveFlag == TRUE && statbuf->st_nlink > 1) {
|
||||
if (is_in_ino_dev_hashtable(statbuf, &name)) {
|
||||
if (link(name, destName) < 0) {
|
||||
error_msg("link(%s, %s): %s\n", name, destName, strerror(errno));
|
||||
perror_msg("link(%s, %s)", name, destName);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -162,11 +161,11 @@ rm_Action(const char *fileName, struct stat *statbuf, void* junk)
|
||||
|
||||
if (S_ISDIR(statbuf->st_mode)) {
|
||||
if (rmdir(fileName) < 0) {
|
||||
error_msg("rmdir(%s): %s\n", fileName, strerror(errno));
|
||||
perror_msg("rmdir(%s)", fileName);
|
||||
status = FALSE;
|
||||
}
|
||||
} else if (unlink(fileName) < 0) {
|
||||
error_msg("unlink(%s): %s\n", fileName, strerror(errno));
|
||||
perror_msg("unlink(%s)", fileName);
|
||||
status = FALSE;
|
||||
}
|
||||
return status;
|
||||
@ -260,20 +259,20 @@ extern int cp_mv_main(int argc, char **argv)
|
||||
char *pushd, *d, *p;
|
||||
|
||||
if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) {
|
||||
error_msg("getcwd(): %s\n", strerror(errno));
|
||||
perror_msg("getcwd()");
|
||||
continue;
|
||||
}
|
||||
if (chdir(baseDestName) < 0) {
|
||||
error_msg("chdir(%s): %s\n", baseSrcName, strerror(errno));
|
||||
perror_msg("chdir(%s)", baseSrcName);
|
||||
continue;
|
||||
}
|
||||
if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) {
|
||||
error_msg("getcwd(): %s\n", strerror(errno));
|
||||
perror_msg("getcwd()");
|
||||
continue;
|
||||
}
|
||||
while (!state && *d != '\0') {
|
||||
if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */
|
||||
error_msg("stat(%s): %s\n", d, strerror(errno));
|
||||
perror_msg("stat(%s)", d);
|
||||
state = -1;
|
||||
continue;
|
||||
}
|
||||
@ -290,7 +289,7 @@ extern int cp_mv_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
if (chdir(pushd) < 0) {
|
||||
error_msg("chdir(%s): %s\n", pushd, strerror(errno));
|
||||
perror_msg("chdir(%s)", pushd);
|
||||
free(pushd);
|
||||
free(d);
|
||||
continue;
|
||||
|
2
cut.c
2
cut.c
@ -234,7 +234,7 @@ extern int cut_main(int argc, char **argv)
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
error_msg("%s: %s\n", argv[i], strerror(errno));
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
cut_file(file);
|
||||
fclose(file);
|
||||
|
@ -50,7 +50,7 @@ int dumpkmap_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
error_msg("Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
perror_msg("Error opening /dev/tty0");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -757,7 +757,7 @@ extern int sed_main(int argc, char **argv)
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
error_msg("%s: %s\n", argv[i], strerror(errno));
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
process_file(file);
|
||||
fclose(file);
|
||||
|
@ -169,7 +169,7 @@ extern int grep_main(int argc, char **argv)
|
||||
file = fopen(cur_file, "r");
|
||||
if (file == NULL) {
|
||||
if (!suppress_err_msgs)
|
||||
error_msg("%s: %s\n", cur_file, strerror(errno));
|
||||
perror_msg("%s", cur_file);
|
||||
}
|
||||
else {
|
||||
grep_file(file);
|
||||
|
@ -43,10 +43,10 @@ freeramdisk_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if ((f = open(argv[1], O_RDWR)) == -1) {
|
||||
error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno));
|
||||
perror_msg_and_die("cannot open %s", argv[1]);
|
||||
}
|
||||
if (ioctl(f, BLKFLSBUF) < 0) {
|
||||
error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
|
||||
perror_msg_and_die("failed ioctl on %s", argv[1]);
|
||||
}
|
||||
/* Don't bother closing. Exit does
|
||||
* that, so we can save a few bytes */
|
||||
|
2
grep.c
2
grep.c
@ -169,7 +169,7 @@ extern int grep_main(int argc, char **argv)
|
||||
file = fopen(cur_file, "r");
|
||||
if (file == NULL) {
|
||||
if (!suppress_err_msgs)
|
||||
error_msg("%s: %s\n", cur_file, strerror(errno));
|
||||
perror_msg("%s", cur_file);
|
||||
}
|
||||
else {
|
||||
grep_file(file);
|
||||
|
2
head.c
2
head.c
@ -80,7 +80,7 @@ int head_main(int argc, char **argv)
|
||||
}
|
||||
head(len, fp);
|
||||
if (errno) {
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
perror_msg("%s", argv[optind]);
|
||||
status = EXIT_FAILURE;
|
||||
errno = 0;
|
||||
}
|
||||
|
26
insmod.c
26
insmod.c
@ -78,7 +78,7 @@
|
||||
#ifndef MODUTILS_MODULE_H
|
||||
#define MODUTILS_MODULE_H 1
|
||||
|
||||
#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
|
||||
|
||||
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
||||
We do not use the kernel headers directly because we do not wish
|
||||
@ -284,7 +284,7 @@ int delete_module(const char *);
|
||||
#ifndef MODUTILS_OBJ_H
|
||||
#define MODUTILS_OBJ_H 1
|
||||
|
||||
#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
|
||||
|
||||
/* The relocatable object is manipulated using elfin types. */
|
||||
|
||||
@ -1562,7 +1562,7 @@ static int old_get_kernel_symbols(const char *m_name)
|
||||
|
||||
nks = get_kernel_syms(NULL);
|
||||
if (nks < 0) {
|
||||
error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("get_kernel_syms: %s", m_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1743,7 +1743,7 @@ old_init_module(const char *m_name, struct obj_file *f,
|
||||
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
|
||||
: 0), &routines, symtab);
|
||||
if (ret)
|
||||
error_msg("init_module: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("init_module: %s", m_name);
|
||||
|
||||
free(image);
|
||||
free(symtab);
|
||||
@ -2055,7 +2055,7 @@ static int new_get_kernel_symbols(void)
|
||||
module_names = xrealloc(module_names, bufsize = ret);
|
||||
goto retry_modules_load;
|
||||
}
|
||||
error_msg("QM_MODULES: %s\n", strerror(errno));
|
||||
perror_msg("QM_MODULES");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2074,7 +2074,7 @@ static int new_get_kernel_symbols(void)
|
||||
/* The module was removed out from underneath us. */
|
||||
continue;
|
||||
}
|
||||
error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
|
||||
perror_msg("query_module: QM_INFO: %s", mn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2089,7 +2089,7 @@ static int new_get_kernel_symbols(void)
|
||||
/* The module was removed out from underneath us. */
|
||||
continue;
|
||||
default:
|
||||
error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
|
||||
perror_msg("query_module: QM_SYMBOLS: %s", mn);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -2114,7 +2114,7 @@ static int new_get_kernel_symbols(void)
|
||||
syms = xrealloc(syms, bufsize = ret);
|
||||
goto retry_kern_sym_load;
|
||||
}
|
||||
error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
|
||||
perror_msg("kernel: QM_SYMBOLS");
|
||||
return 0;
|
||||
}
|
||||
nksyms = nsyms = ret;
|
||||
@ -2295,7 +2295,7 @@ new_init_module(const char *m_name, struct obj_file *f,
|
||||
|
||||
ret = new_sys_init_module(m_name, (struct new_module *) image);
|
||||
if (ret)
|
||||
error_msg("init_module: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("init_module: %s", m_name);
|
||||
|
||||
free(image);
|
||||
|
||||
@ -2680,7 +2680,7 @@ struct obj_file *obj_load(FILE * fp)
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
|
||||
error_msg("error reading ELF header: %s\n", strerror(errno));
|
||||
perror_msg("error reading ELF header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2719,7 +2719,7 @@ struct obj_file *obj_load(FILE * fp)
|
||||
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
|
||||
fseek(fp, f->header.e_shoff, SEEK_SET);
|
||||
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
|
||||
error_msg("error reading ELF section headers: %s\n", strerror(errno));
|
||||
perror_msg("error reading ELF section headers");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2749,7 +2749,7 @@ struct obj_file *obj_load(FILE * fp)
|
||||
sec->contents = xmalloc(sec->header.sh_size);
|
||||
fseek(fp, sec->header.sh_offset, SEEK_SET);
|
||||
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
|
||||
error_msg("error reading ELF section data: %s\n", strerror(errno));
|
||||
perror_msg("error reading ELF section data");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
@ -3075,7 +3075,7 @@ extern int insmod_main( int argc, char **argv)
|
||||
m_size);
|
||||
goto out;
|
||||
default:
|
||||
error_msg("create_module: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("create_module: %s", m_name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
6
kill.c
6
kill.c
@ -204,10 +204,10 @@ extern int kill_main(int argc, char **argv)
|
||||
int pid;
|
||||
|
||||
if (!isdigit(**argv))
|
||||
error_msg_and_die( "Bad PID: %s\n", strerror(errno));
|
||||
perror_msg_and_die( "Bad PID");
|
||||
pid = strtol(*argv, NULL, 0);
|
||||
if (kill(pid, sig) != 0)
|
||||
error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno));
|
||||
perror_msg_and_die( "Could not kill pid '%d'", pid);
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
@ -229,7 +229,7 @@ extern int kill_main(int argc, char **argv)
|
||||
if (*pidList==myPid)
|
||||
continue;
|
||||
if (kill(*pidList, sig) != 0)
|
||||
error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
|
||||
perror_msg_and_die( "Could not kill pid '%d'", *pidList);
|
||||
}
|
||||
/* Note that we don't bother to free the memory
|
||||
* allocated in find_pid_by_name(). It will be freed
|
||||
|
@ -39,13 +39,11 @@ int loadacm_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
if (fd < 0) {
|
||||
error_msg("Error opening /dev/tty1: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
perror_msg_and_die("Error opening /dev/tty1");
|
||||
}
|
||||
|
||||
if (screen_map_load(fd, stdin)) {
|
||||
error_msg("Error loading acm: %s\n", strerror(errno));
|
||||
return EXIT_FAILURE;
|
||||
perror_msg_and_die("Error loading acm");
|
||||
}
|
||||
|
||||
write(fd, "\033(K", 3);
|
||||
|
6
ls.c
6
ls.c
@ -181,7 +181,7 @@ static int my_stat(struct dnode *cur)
|
||||
#ifdef BB_FEATURE_LS_FOLLOWLINKS
|
||||
if (follow_links == TRUE) {
|
||||
if (stat(cur->fullname, &cur->dstat)) {
|
||||
error_msg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
perror_msg("%s", cur->fullname);
|
||||
status = EXIT_FAILURE;
|
||||
free(cur->fullname);
|
||||
free(cur);
|
||||
@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur)
|
||||
} else
|
||||
#endif
|
||||
if (lstat(cur->fullname, &cur->dstat)) {
|
||||
error_msg("%s: %s\n", cur->fullname, strerror(errno));
|
||||
perror_msg("%s", cur->fullname);
|
||||
status = EXIT_FAILURE;
|
||||
free(cur->fullname);
|
||||
free(cur);
|
||||
@ -511,7 +511,7 @@ struct dnode **list_dir(char *path)
|
||||
nfiles= 0;
|
||||
dir = opendir(path);
|
||||
if (dir == NULL) {
|
||||
error_msg("%s: %s\n", path, strerror(errno));
|
||||
perror_msg("%s", path);
|
||||
status = EXIT_FAILURE;
|
||||
return(NULL); /* could not open the dir */
|
||||
}
|
||||
|
10
md5sum.c
10
md5sum.c
@ -651,13 +651,13 @@ static int md5_file(const char *filename,
|
||||
} else {
|
||||
fp = fopen(filename, OPENOPTS(binary));
|
||||
if (fp == NULL) {
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
perror_msg("%s", filename);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (md5_stream(fp, md5_result)) {
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
perror_msg("%s", filename);
|
||||
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
@ -665,7 +665,7 @@ static int md5_file(const char *filename,
|
||||
}
|
||||
|
||||
if (fp != stdin && fclose(fp) == EOF) {
|
||||
error_msg("%s: %s\n", filename, strerror(errno));
|
||||
perror_msg("%s", filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name)
|
||||
} else {
|
||||
checkfile_stream = fopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL) {
|
||||
error_msg("%s: %s\n", checkfile_name, strerror(errno));
|
||||
perror_msg("%s", checkfile_name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name)
|
||||
}
|
||||
|
||||
if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) {
|
||||
error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
|
||||
perror_msg("md5sum: %s", checkfile_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ int readlink_main(int argc, char **argv)
|
||||
buf = xrealloc(buf, bufsize);
|
||||
size = readlink(argv[1], buf, bufsize);
|
||||
if (size == -1)
|
||||
error_msg_and_die("%s: %s\n", argv[1], strerror(errno));
|
||||
perror_msg_and_die("%s", argv[1]);
|
||||
}
|
||||
|
||||
buf[size] = '\0';
|
||||
|
@ -78,7 +78,7 @@
|
||||
#ifndef MODUTILS_MODULE_H
|
||||
#define MODUTILS_MODULE_H 1
|
||||
|
||||
#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
|
||||
|
||||
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
||||
We do not use the kernel headers directly because we do not wish
|
||||
@ -284,7 +284,7 @@ int delete_module(const char *);
|
||||
#ifndef MODUTILS_OBJ_H
|
||||
#define MODUTILS_OBJ_H 1
|
||||
|
||||
#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
|
||||
|
||||
/* The relocatable object is manipulated using elfin types. */
|
||||
|
||||
@ -1562,7 +1562,7 @@ static int old_get_kernel_symbols(const char *m_name)
|
||||
|
||||
nks = get_kernel_syms(NULL);
|
||||
if (nks < 0) {
|
||||
error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("get_kernel_syms: %s", m_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1743,7 +1743,7 @@ old_init_module(const char *m_name, struct obj_file *f,
|
||||
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
|
||||
: 0), &routines, symtab);
|
||||
if (ret)
|
||||
error_msg("init_module: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("init_module: %s", m_name);
|
||||
|
||||
free(image);
|
||||
free(symtab);
|
||||
@ -2055,7 +2055,7 @@ static int new_get_kernel_symbols(void)
|
||||
module_names = xrealloc(module_names, bufsize = ret);
|
||||
goto retry_modules_load;
|
||||
}
|
||||
error_msg("QM_MODULES: %s\n", strerror(errno));
|
||||
perror_msg("QM_MODULES");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2074,7 +2074,7 @@ static int new_get_kernel_symbols(void)
|
||||
/* The module was removed out from underneath us. */
|
||||
continue;
|
||||
}
|
||||
error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
|
||||
perror_msg("query_module: QM_INFO: %s", mn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2089,7 +2089,7 @@ static int new_get_kernel_symbols(void)
|
||||
/* The module was removed out from underneath us. */
|
||||
continue;
|
||||
default:
|
||||
error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
|
||||
perror_msg("query_module: QM_SYMBOLS: %s", mn);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -2114,7 +2114,7 @@ static int new_get_kernel_symbols(void)
|
||||
syms = xrealloc(syms, bufsize = ret);
|
||||
goto retry_kern_sym_load;
|
||||
}
|
||||
error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
|
||||
perror_msg("kernel: QM_SYMBOLS");
|
||||
return 0;
|
||||
}
|
||||
nksyms = nsyms = ret;
|
||||
@ -2295,7 +2295,7 @@ new_init_module(const char *m_name, struct obj_file *f,
|
||||
|
||||
ret = new_sys_init_module(m_name, (struct new_module *) image);
|
||||
if (ret)
|
||||
error_msg("init_module: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("init_module: %s", m_name);
|
||||
|
||||
free(image);
|
||||
|
||||
@ -2680,7 +2680,7 @@ struct obj_file *obj_load(FILE * fp)
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
|
||||
error_msg("error reading ELF header: %s\n", strerror(errno));
|
||||
perror_msg("error reading ELF header");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2719,7 +2719,7 @@ struct obj_file *obj_load(FILE * fp)
|
||||
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
|
||||
fseek(fp, f->header.e_shoff, SEEK_SET);
|
||||
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
|
||||
error_msg("error reading ELF section headers: %s\n", strerror(errno));
|
||||
perror_msg("error reading ELF section headers");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2749,7 +2749,7 @@ struct obj_file *obj_load(FILE * fp)
|
||||
sec->contents = xmalloc(sec->header.sh_size);
|
||||
fseek(fp, sec->header.sh_offset, SEEK_SET);
|
||||
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
|
||||
error_msg("error reading ELF section data: %s\n", strerror(errno));
|
||||
perror_msg("error reading ELF section data");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
@ -3075,7 +3075,7 @@ extern int insmod_main( int argc, char **argv)
|
||||
m_size);
|
||||
goto out;
|
||||
default:
|
||||
error_msg("create_module: %s: %s\n", m_name, strerror(errno));
|
||||
perror_msg("create_module: %s", m_name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
19
mount.c
19
mount.c
@ -271,18 +271,18 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
/* open device */
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die("open failed for `%s'", device);
|
||||
|
||||
/* How many filesystems? We need to know to allocate enough space */
|
||||
numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS);
|
||||
if (numfilesystems<0)
|
||||
error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS");
|
||||
fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype));
|
||||
|
||||
/* Grab the list of available filesystems */
|
||||
status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist);
|
||||
if (status<0)
|
||||
error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS");
|
||||
|
||||
/* Walk the list trying to mount filesystems
|
||||
* that do not claim to be nodev filesystems */
|
||||
@ -307,8 +307,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
|
||||
if (status == FALSE) {
|
||||
if (whineOnErrors == TRUE) {
|
||||
error_msg("Mounting %s on %s failed: %s\n",
|
||||
blockDevice, directory, strerror(errno));
|
||||
perror_msg("Mounting %s on %s failed", blockDevice, directory);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
@ -340,18 +339,18 @@ extern int mount_main(int argc, char **argv)
|
||||
/* open device */
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die("open failed for `%s'", device);
|
||||
|
||||
/* How many mounted filesystems? We need to know to
|
||||
* allocate enough space for later... */
|
||||
numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
|
||||
if (numfilesystems<0)
|
||||
error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS");
|
||||
mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent));
|
||||
|
||||
/* Grab the list of mounted filesystems */
|
||||
if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
|
||||
error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
|
||||
|
||||
for( i = 0 ; i < numfilesystems ; i++) {
|
||||
fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
|
||||
@ -453,7 +452,7 @@ extern int mount_main(int argc, char **argv)
|
||||
fstabmount = TRUE;
|
||||
|
||||
if (f == NULL)
|
||||
error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nCannot read /etc/fstab");
|
||||
|
||||
while ((m = getmntent(f)) != NULL) {
|
||||
if (all == FALSE && directory == NULL && (
|
||||
@ -487,7 +486,7 @@ singlemount:
|
||||
rc = nfsmount (device, directory, &flags,
|
||||
&extra_opts, &string_flags, 1);
|
||||
if ( rc != 0) {
|
||||
error_msg_and_die("nfsmount failed: %s\n", strerror(errno));
|
||||
perror_msg_and_die("nfsmount failed");
|
||||
rc = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw Exp $
|
||||
* $Id: ping.c,v 1.29 2000/12/18 03:57:16 kraai Exp $
|
||||
* Mini ping implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||
@ -325,7 +325,7 @@ static void sendping(int junk)
|
||||
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
||||
|
||||
if (i < 0)
|
||||
error_msg_and_die("sendto: %s\n", strerror(errno));
|
||||
perror_msg_and_die("sendto");
|
||||
else if ((size_t)i != sizeof(packet))
|
||||
error_msg_and_die("ping wrote %d chars; %d expected\n", i,
|
||||
(int)sizeof(packet));
|
||||
|
@ -650,7 +650,7 @@ static int remote_connect(struct in_addr addr, int port)
|
||||
|
||||
if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0)
|
||||
{
|
||||
error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno));
|
||||
perror_msg_and_die("Unable to connect to remote host");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
4
ping.c
4
ping.c
@ -1,6 +1,6 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw Exp $
|
||||
* $Id: ping.c,v 1.29 2000/12/18 03:57:16 kraai Exp $
|
||||
* Mini ping implementation for busybox
|
||||
*
|
||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||
@ -325,7 +325,7 @@ static void sendping(int junk)
|
||||
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
|
||||
|
||||
if (i < 0)
|
||||
error_msg_and_die("sendto: %s\n", strerror(errno));
|
||||
perror_msg_and_die("sendto");
|
||||
else if ((size_t)i != sizeof(packet))
|
||||
error_msg_and_die("ping wrote %d chars; %d expected\n", i,
|
||||
(int)sizeof(packet));
|
||||
|
@ -204,10 +204,10 @@ extern int kill_main(int argc, char **argv)
|
||||
int pid;
|
||||
|
||||
if (!isdigit(**argv))
|
||||
error_msg_and_die( "Bad PID: %s\n", strerror(errno));
|
||||
perror_msg_and_die( "Bad PID");
|
||||
pid = strtol(*argv, NULL, 0);
|
||||
if (kill(pid, sig) != 0)
|
||||
error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno));
|
||||
perror_msg_and_die( "Could not kill pid '%d'", pid);
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
@ -229,7 +229,7 @@ extern int kill_main(int argc, char **argv)
|
||||
if (*pidList==myPid)
|
||||
continue;
|
||||
if (kill(*pidList, sig) != 0)
|
||||
error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
|
||||
perror_msg_and_die( "Could not kill pid '%d'", *pidList);
|
||||
}
|
||||
/* Note that we don't bother to free the memory
|
||||
* allocated in find_pid_by_name(). It will be freed
|
||||
|
10
procps/ps.c
10
procps/ps.c
@ -216,11 +216,11 @@ extern int ps_main(int argc, char **argv)
|
||||
/* open device */
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die( "open failed for `%s'", device);
|
||||
|
||||
/* Find out how many processes there are */
|
||||
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
|
||||
error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
|
||||
|
||||
/* Allocate some memory -- grab a few extras just in case
|
||||
* some new processes start up while we wait. The kernel will
|
||||
@ -231,7 +231,7 @@ extern int ps_main(int argc, char **argv)
|
||||
|
||||
/* Now grab the pid list */
|
||||
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
|
||||
error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVPS_GET_PID_LIST");
|
||||
|
||||
#ifdef BB_FEATURE_AUTOWIDTH
|
||||
ioctl(fileno(stdout), TIOCGWINSZ, &win);
|
||||
@ -247,7 +247,7 @@ extern int ps_main(int argc, char **argv)
|
||||
info.pid = pid_array[i];
|
||||
|
||||
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
|
||||
error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVPS_GET_PID_INFO");
|
||||
|
||||
/* Make some adjustments as needed */
|
||||
my_getpwuid(uidName, info.euid);
|
||||
@ -277,7 +277,7 @@ extern int ps_main(int argc, char **argv)
|
||||
|
||||
/* close device */
|
||||
if (close (fd) != 0)
|
||||
error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die("close failed for `%s'", device);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
10
ps.c
10
ps.c
@ -216,11 +216,11 @@ extern int ps_main(int argc, char **argv)
|
||||
/* open device */
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die( "open failed for `%s'", device);
|
||||
|
||||
/* Find out how many processes there are */
|
||||
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
|
||||
error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
|
||||
|
||||
/* Allocate some memory -- grab a few extras just in case
|
||||
* some new processes start up while we wait. The kernel will
|
||||
@ -231,7 +231,7 @@ extern int ps_main(int argc, char **argv)
|
||||
|
||||
/* Now grab the pid list */
|
||||
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
|
||||
error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVPS_GET_PID_LIST");
|
||||
|
||||
#ifdef BB_FEATURE_AUTOWIDTH
|
||||
ioctl(fileno(stdout), TIOCGWINSZ, &win);
|
||||
@ -247,7 +247,7 @@ extern int ps_main(int argc, char **argv)
|
||||
info.pid = pid_array[i];
|
||||
|
||||
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
|
||||
error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVPS_GET_PID_INFO");
|
||||
|
||||
/* Make some adjustments as needed */
|
||||
my_getpwuid(uidName, info.euid);
|
||||
@ -277,7 +277,7 @@ extern int ps_main(int argc, char **argv)
|
||||
|
||||
/* close device */
|
||||
if (close (fd) != 0)
|
||||
error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die("close failed for `%s'", device);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
4
pwd.c
4
pwd.c
@ -31,8 +31,8 @@ extern int pwd_main(int argc, char **argv)
|
||||
char buf[BUFSIZ + 1];
|
||||
|
||||
if (getcwd(buf, sizeof(buf)) == NULL)
|
||||
error_msg_and_die("%s\n", strerror(errno));
|
||||
perror_msg_and_die("getcwd");
|
||||
|
||||
printf("%s\n", buf);
|
||||
puts(buf);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
10
rdate.c
10
rdate.c
@ -47,15 +47,15 @@ time_t askremotedate(char *host)
|
||||
int fd;
|
||||
|
||||
if (!(h = gethostbyname(host))) { /* get the IP addr */
|
||||
error_msg("%s: %s\n", host, strerror(errno));
|
||||
perror_msg("%s", host);
|
||||
return(-1);
|
||||
}
|
||||
if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
|
||||
error_msg("%s: %s\n", "time", strerror(errno));
|
||||
perror_msg("%s", "time");
|
||||
return(-1);
|
||||
}
|
||||
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
|
||||
error_msg("%s: %s\n", "socket", strerror(errno));
|
||||
perror_msg("%s", "socket");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ time_t askremotedate(char *host)
|
||||
sin.sin_family = AF_INET;
|
||||
|
||||
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
|
||||
error_msg("%s: %s\n", host, strerror(errno));
|
||||
perror_msg("%s", host);
|
||||
close(fd);
|
||||
return(-1);
|
||||
}
|
||||
@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv)
|
||||
}
|
||||
if (setdate) {
|
||||
if (stime(&time) < 0)
|
||||
error_msg_and_die("Could not set time of day: %s\n", strerror(errno));
|
||||
perror_msg_and_die("Could not set time of day");
|
||||
}
|
||||
if (printdate) {
|
||||
fprintf(stdout, "%s", ctime(&time));
|
||||
|
@ -39,7 +39,7 @@ int readlink_main(int argc, char **argv)
|
||||
buf = xrealloc(buf, bufsize);
|
||||
size = readlink(argv[1], buf, bufsize);
|
||||
if (size == -1)
|
||||
error_msg_and_die("%s: %s\n", argv[1], strerror(errno));
|
||||
perror_msg_and_die("%s", argv[1]);
|
||||
}
|
||||
|
||||
buf[size] = '\0';
|
||||
|
2
sed.c
2
sed.c
@ -757,7 +757,7 @@ extern int sed_main(int argc, char **argv)
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
error_msg("%s: %s\n", argv[i], strerror(errno));
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
process_file(file);
|
||||
fclose(file);
|
||||
|
@ -313,7 +313,7 @@ static void doSyslogd (void)
|
||||
/* Create the syslog file so realpath() can work. */
|
||||
close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
|
||||
if (realpath (_PATH_LOG, lfile) == NULL)
|
||||
error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Could not resolve path to " _PATH_LOG);
|
||||
|
||||
unlink (lfile);
|
||||
|
||||
@ -321,14 +321,14 @@ static void doSyslogd (void)
|
||||
sunx.sun_family = AF_UNIX;
|
||||
strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
|
||||
if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
|
||||
error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG);
|
||||
|
||||
addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
|
||||
if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
|
||||
error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Could not connect to socket " _PATH_LOG);
|
||||
|
||||
if (chmod (lfile, 0666) < 0)
|
||||
error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Could not set permission on " _PATH_LOG);
|
||||
|
||||
FD_ZERO (&fds);
|
||||
FD_SET (sock_fd, &fds);
|
||||
@ -351,7 +351,7 @@ static void doSyslogd (void)
|
||||
|
||||
if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
|
||||
if (errno == EINTR) continue; /* alarm may have happened. */
|
||||
error_msg_and_die ("select error: %s\n", strerror (errno));
|
||||
perror_msg_and_die ("select error");
|
||||
}
|
||||
|
||||
for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
|
||||
@ -365,7 +365,7 @@ static void doSyslogd (void)
|
||||
pid_t pid;
|
||||
|
||||
if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
|
||||
error_msg_and_die ("accept error: %s\n", strerror (errno));
|
||||
perror_msg_and_die ("accept error");
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
|
12
syslogd.c
12
syslogd.c
@ -313,7 +313,7 @@ static void doSyslogd (void)
|
||||
/* Create the syslog file so realpath() can work. */
|
||||
close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
|
||||
if (realpath (_PATH_LOG, lfile) == NULL)
|
||||
error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Could not resolve path to " _PATH_LOG);
|
||||
|
||||
unlink (lfile);
|
||||
|
||||
@ -321,14 +321,14 @@ static void doSyslogd (void)
|
||||
sunx.sun_family = AF_UNIX;
|
||||
strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
|
||||
if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
|
||||
error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG);
|
||||
|
||||
addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
|
||||
if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
|
||||
error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Could not connect to socket " _PATH_LOG);
|
||||
|
||||
if (chmod (lfile, 0666) < 0)
|
||||
error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
|
||||
perror_msg_and_die ("Could not set permission on " _PATH_LOG);
|
||||
|
||||
FD_ZERO (&fds);
|
||||
FD_SET (sock_fd, &fds);
|
||||
@ -351,7 +351,7 @@ static void doSyslogd (void)
|
||||
|
||||
if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
|
||||
if (errno == EINTR) continue; /* alarm may have happened. */
|
||||
error_msg_and_die ("select error: %s\n", strerror (errno));
|
||||
perror_msg_and_die ("select error");
|
||||
}
|
||||
|
||||
for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
|
||||
@ -365,7 +365,7 @@ static void doSyslogd (void)
|
||||
pid_t pid;
|
||||
|
||||
if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
|
||||
error_msg_and_die ("accept error: %s\n", strerror (errno));
|
||||
perror_msg_and_die ("accept error");
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
|
25
tar.c
25
tar.c
@ -317,7 +317,7 @@ extern int tar_main(int argc, char **argv)
|
||||
else
|
||||
tarFd = open(tarName, O_RDONLY);
|
||||
if (tarFd < 0)
|
||||
error_msg_and_die( "Error opening '%s': %s\n", tarName, strerror(errno));
|
||||
perror_msg_and_die("Error opening '%s'", tarName);
|
||||
|
||||
#ifdef BB_FEATURE_TAR_GZIP
|
||||
/* unzip tarFd in a seperate process */
|
||||
@ -425,8 +425,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
return( TRUE);
|
||||
|
||||
if (create_path(header->name, header->mode) != TRUE) {
|
||||
error_msg("%s: Cannot mkdir: %s\n",
|
||||
header->name, strerror(errno));
|
||||
perror_msg("%s: Cannot mkdir", header->name);
|
||||
return( FALSE);
|
||||
}
|
||||
/* make the final component, just in case it was
|
||||
@ -445,8 +444,8 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
return( TRUE);
|
||||
|
||||
if (link(header->linkname, header->name) < 0) {
|
||||
error_msg("%s: Cannot create hard link to '%s': %s\n",
|
||||
header->name, header->linkname, strerror(errno));
|
||||
perror_msg("%s: Cannot create hard link to '%s'", header->name,
|
||||
header->linkname);
|
||||
return( FALSE);
|
||||
}
|
||||
|
||||
@ -463,8 +462,8 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
|
||||
#ifdef S_ISLNK
|
||||
if (symlink(header->linkname, header->name) < 0) {
|
||||
error_msg("%s: Cannot create symlink to '%s': %s\n",
|
||||
header->name, header->linkname, strerror(errno));
|
||||
perror_msg("%s: Cannot create symlink to '%s'", header->name,
|
||||
header->linkname);
|
||||
return( FALSE);
|
||||
}
|
||||
/* Try to change ownership of the symlink.
|
||||
@ -493,14 +492,12 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
|
||||
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) {
|
||||
error_msg("%s: Cannot mknod: %s\n",
|
||||
header->name, strerror(errno));
|
||||
perror_msg("%s: Cannot mknod", header->name);
|
||||
return( FALSE);
|
||||
}
|
||||
} else if (S_ISFIFO(header->mode)) {
|
||||
if (mkfifo(header->name, header->mode) < 0) {
|
||||
error_msg("%s: Cannot mkfifo: %s\n",
|
||||
header->name, strerror(errno));
|
||||
perror_msg("%s: Cannot mkfifo", header->name);
|
||||
return( FALSE);
|
||||
}
|
||||
}
|
||||
@ -790,7 +787,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
||||
close(tarFd);
|
||||
if (status > 0) {
|
||||
/* Bummer - we read a partial header */
|
||||
error_msg( "Error reading tar file: %s\n", strerror(errno));
|
||||
perror_msg("Error reading tar file");
|
||||
return ( FALSE);
|
||||
}
|
||||
else if (errorFlag==TRUE) {
|
||||
@ -1007,7 +1004,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
|
||||
header.typeflag = SYMTYPE;
|
||||
link_size = readlink(fileName, buffer, sizeof(buffer) - 1);
|
||||
if ( link_size < 0) {
|
||||
error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
|
||||
perror_msg("Error reading symlink '%s'", header.name);
|
||||
return ( FALSE);
|
||||
}
|
||||
buffer[link_size] = '\0';
|
||||
@ -1165,7 +1162,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
|
||||
else
|
||||
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (tbInfo.tarFd < 0) {
|
||||
error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
|
||||
perror_msg( "Error opening '%s'", tarName);
|
||||
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
||||
return ( FALSE);
|
||||
}
|
||||
|
2
tee.c
2
tee.c
@ -47,7 +47,7 @@ tee_main(int argc, char **argv)
|
||||
while (optind < argc) {
|
||||
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
|
||||
nfiles--;
|
||||
error_msg("%s: %s\n", argv[optind-1], strerror(errno));
|
||||
perror_msg("%s", argv[optind-1]);
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
|
2
telnet.c
2
telnet.c
@ -650,7 +650,7 @@ static int remote_connect(struct in_addr addr, int port)
|
||||
|
||||
if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0)
|
||||
{
|
||||
error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno));
|
||||
perror_msg_and_die("Unable to connect to remote host");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -43,10 +43,10 @@ freeramdisk_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if ((f = open(argv[1], O_RDWR)) == -1) {
|
||||
error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno));
|
||||
perror_msg_and_die("cannot open %s", argv[1]);
|
||||
}
|
||||
if (ioctl(f, BLKFLSBUF) < 0) {
|
||||
error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
|
||||
perror_msg_and_die("failed ioctl on %s", argv[1]);
|
||||
}
|
||||
/* Don't bother closing. Exit does
|
||||
* that, so we can save a few bytes */
|
||||
|
@ -271,18 +271,18 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
/* open device */
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die("open failed for `%s'", device);
|
||||
|
||||
/* How many filesystems? We need to know to allocate enough space */
|
||||
numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS);
|
||||
if (numfilesystems<0)
|
||||
error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS");
|
||||
fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype));
|
||||
|
||||
/* Grab the list of available filesystems */
|
||||
status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist);
|
||||
if (status<0)
|
||||
error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
|
||||
perror_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS");
|
||||
|
||||
/* Walk the list trying to mount filesystems
|
||||
* that do not claim to be nodev filesystems */
|
||||
@ -307,8 +307,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
|
||||
if (status == FALSE) {
|
||||
if (whineOnErrors == TRUE) {
|
||||
error_msg("Mounting %s on %s failed: %s\n",
|
||||
blockDevice, directory, strerror(errno));
|
||||
perror_msg("Mounting %s on %s failed", blockDevice, directory);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
@ -340,18 +339,18 @@ extern int mount_main(int argc, char **argv)
|
||||
/* open device */
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die("open failed for `%s'", device);
|
||||
|
||||
/* How many mounted filesystems? We need to know to
|
||||
* allocate enough space for later... */
|
||||
numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
|
||||
if (numfilesystems<0)
|
||||
error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS");
|
||||
mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent));
|
||||
|
||||
/* Grab the list of mounted filesystems */
|
||||
if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
|
||||
error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
|
||||
|
||||
for( i = 0 ; i < numfilesystems ; i++) {
|
||||
fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
|
||||
@ -453,7 +452,7 @@ extern int mount_main(int argc, char **argv)
|
||||
fstabmount = TRUE;
|
||||
|
||||
if (f == NULL)
|
||||
error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nCannot read /etc/fstab");
|
||||
|
||||
while ((m = getmntent(f)) != NULL) {
|
||||
if (all == FALSE && directory == NULL && (
|
||||
@ -487,7 +486,7 @@ singlemount:
|
||||
rc = nfsmount (device, directory, &flags,
|
||||
&extra_opts, &string_flags, 1);
|
||||
if ( rc != 0) {
|
||||
error_msg_and_die("nfsmount failed: %s\n", strerror(errno));
|
||||
perror_msg_and_die("nfsmount failed");
|
||||
rc = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -47,15 +47,15 @@ time_t askremotedate(char *host)
|
||||
int fd;
|
||||
|
||||
if (!(h = gethostbyname(host))) { /* get the IP addr */
|
||||
error_msg("%s: %s\n", host, strerror(errno));
|
||||
perror_msg("%s", host);
|
||||
return(-1);
|
||||
}
|
||||
if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
|
||||
error_msg("%s: %s\n", "time", strerror(errno));
|
||||
perror_msg("%s", "time");
|
||||
return(-1);
|
||||
}
|
||||
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
|
||||
error_msg("%s: %s\n", "socket", strerror(errno));
|
||||
perror_msg("%s", "socket");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ time_t askremotedate(char *host)
|
||||
sin.sin_family = AF_INET;
|
||||
|
||||
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
|
||||
error_msg("%s: %s\n", host, strerror(errno));
|
||||
perror_msg("%s", host);
|
||||
close(fd);
|
||||
return(-1);
|
||||
}
|
||||
@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv)
|
||||
}
|
||||
if (setdate) {
|
||||
if (stime(&time) < 0)
|
||||
error_msg_and_die("Could not set time of day: %s\n", strerror(errno));
|
||||
perror_msg_and_die("Could not set time of day");
|
||||
}
|
||||
if (printdate) {
|
||||
fprintf(stdout, "%s", ctime(&time));
|
||||
|
16
utility.c
16
utility.c
@ -1313,11 +1313,11 @@ extern pid_t* find_pid_by_name( char* pidName)
|
||||
/* open device */
|
||||
fd = open(device, O_RDONLY);
|
||||
if (fd < 0)
|
||||
error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
|
||||
perror_msg_and_die( "open failed for `%s'", device);
|
||||
|
||||
/* Find out how many processes there are */
|
||||
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
|
||||
error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
|
||||
|
||||
/* Allocate some memory -- grab a few extras just in case
|
||||
* some new processes start up while we wait. The kernel will
|
||||
@ -1328,7 +1328,7 @@ extern pid_t* find_pid_by_name( char* pidName)
|
||||
|
||||
/* Now grab the pid list */
|
||||
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
|
||||
error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
|
||||
|
||||
/* Now search for a match */
|
||||
for (i=1, j=0; i<pid_array[0] ; i++) {
|
||||
@ -1337,7 +1337,7 @@ extern pid_t* find_pid_by_name( char* pidName)
|
||||
|
||||
info.pid = pid_array[i];
|
||||
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
|
||||
error_msg_and_die( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "\nDEVPS_GET_PID_INFO");
|
||||
|
||||
/* Make sure we only match on the process name */
|
||||
p=info.command_line+1;
|
||||
@ -1361,7 +1361,7 @@ extern pid_t* find_pid_by_name( char* pidName)
|
||||
|
||||
/* close device */
|
||||
if (close (fd) != 0)
|
||||
error_msg_and_die( "close failed for `%s': %s\n",device, strerror (errno));
|
||||
perror_msg_and_die( "close failed for `%s'", device);
|
||||
|
||||
return pidList;
|
||||
}
|
||||
@ -1387,7 +1387,7 @@ extern pid_t* find_pid_by_name( char* pidName)
|
||||
|
||||
dir = opendir("/proc");
|
||||
if (!dir)
|
||||
error_msg_and_die( "Cannot open /proc: %s\n", strerror (errno));
|
||||
perror_msg_and_die( "Cannot open /proc");
|
||||
|
||||
while ((next = readdir(dir)) != NULL) {
|
||||
FILE *status;
|
||||
@ -1764,7 +1764,7 @@ FILE *wfopen(const char *path, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
if ((fp = fopen(path, mode)) == NULL) {
|
||||
error_msg("%s: %s\n", path, strerror(errno));
|
||||
perror_msg("%s", path);
|
||||
errno = 0;
|
||||
}
|
||||
return fp;
|
||||
@ -1778,7 +1778,7 @@ FILE *xfopen(const char *path, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
if ((fp = fopen(path, mode)) == NULL)
|
||||
error_msg_and_die("%s: %s\n", path, strerror(errno));
|
||||
perror_msg_and_die("%s", path);
|
||||
return fp;
|
||||
}
|
||||
#endif
|
||||
|
@ -257,7 +257,7 @@ static int decode (const char *inname,
|
||||
&& (freopen (outname, "w", stdout) == NULL
|
||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||
)) {
|
||||
error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||
perror_msg("%s", outname); /* */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ int uudecode_main (int argc,
|
||||
if (decode (argv[optind], outname) != 0)
|
||||
exit_status = FALSE;
|
||||
} else {
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
perror_msg("%s", argv[optind]);
|
||||
exit_status = EXIT_FAILURE;
|
||||
}
|
||||
optind++;
|
||||
|
@ -160,15 +160,12 @@ int uuencode_main (int argc,
|
||||
trans_ptr = uu_std; /* Standard encoding is old uu format */
|
||||
|
||||
/* Parse any options */
|
||||
while ((opt = getopt (argc, argv, "m")) != EOF) {
|
||||
while ((opt = getopt (argc, argv, "m")) > 0) {
|
||||
switch (opt) {
|
||||
case 'm':
|
||||
trans_ptr = uu_base64;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(uuencode_usage);
|
||||
}
|
||||
@ -178,7 +175,7 @@ int uuencode_main (int argc,
|
||||
case 2:
|
||||
/* Optional first argument is input file. */
|
||||
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
||||
error_msg("%s: %s\n", argv[optind], strerror(errno));
|
||||
perror_msg("%s", argv[optind]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
Loading…
x
Reference in New Issue
Block a user