Change calls to error_msg.* and strerror to use perror_msg.*.
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user