diff options
author | Matt Kraai <kraai@debian.org> | 2000-12-18 03:57:16 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2000-12-18 03:57:16 +0000 |
commit | 1fa1adea2ae16d4f4c82d7466905dce4c6edd5f5 (patch) | |
tree | b85a425c19b299f5d8635599e11c78c96f12a4c2 /util-linux | |
parent | 0dab82997777bffb95d01d68e1628ee79207a03d (diff) |
Change calls to error_msg.* and strerror to use perror_msg.*.
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/freeramdisk.c | 4 | ||||
-rw-r--r-- | util-linux/mount.c | 19 | ||||
-rw-r--r-- | util-linux/rdate.c | 10 |
3 files changed, 16 insertions, 17 deletions
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index a568cc67c..a2b17c673 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -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 */ diff --git a/util-linux/mount.c b/util-linux/mount.c index 06673f942..8240b99aa 100644 --- a/util-linux/mount.c +++ b/util-linux/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; } } diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 87edecbfc..03f7f2de3 100644 --- a/util-linux/rdate.c +++ b/util-linux/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)); |