summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-12-18 03:57:16 +0000
committerMatt Kraai <kraai@debian.org>2000-12-18 03:57:16 +0000
commit1fa1adea2ae16d4f4c82d7466905dce4c6edd5f5 (patch)
treeb85a425c19b299f5d8635599e11c78c96f12a4c2 /util-linux
parent0dab82997777bffb95d01d68e1628ee79207a03d (diff)
downloadbusybox-w32-1fa1adea2ae16d4f4c82d7466905dce4c6edd5f5.tar.gz
busybox-w32-1fa1adea2ae16d4f4c82d7466905dce4c6edd5f5.tar.bz2
busybox-w32-1fa1adea2ae16d4f4c82d7466905dce4c6edd5f5.zip
Change calls to error_msg.* and strerror to use perror_msg.*.
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/freeramdisk.c4
-rw-r--r--util-linux/mount.c19
-rw-r--r--util-linux/rdate.c10
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)
43 } 43 }
44 44
45 if ((f = open(argv[1], O_RDWR)) == -1) { 45 if ((f = open(argv[1], O_RDWR)) == -1) {
46 error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno)); 46 perror_msg_and_die("cannot open %s", argv[1]);
47 } 47 }
48 if (ioctl(f, BLKFLSBUF) < 0) { 48 if (ioctl(f, BLKFLSBUF) < 0) {
49 error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno)); 49 perror_msg_and_die("failed ioctl on %s", argv[1]);
50 } 50 }
51 /* Don't bother closing. Exit does 51 /* Don't bother closing. Exit does
52 * that, so we can save a few bytes */ 52 * 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,
271 /* open device */ 271 /* open device */
272 fd = open(device, O_RDONLY); 272 fd = open(device, O_RDONLY);
273 if (fd < 0) 273 if (fd < 0)
274 error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); 274 perror_msg_and_die("open failed for `%s'", device);
275 275
276 /* How many filesystems? We need to know to allocate enough space */ 276 /* How many filesystems? We need to know to allocate enough space */
277 numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS); 277 numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS);
278 if (numfilesystems<0) 278 if (numfilesystems<0)
279 error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno)); 279 perror_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS");
280 fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype)); 280 fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype));
281 281
282 /* Grab the list of available filesystems */ 282 /* Grab the list of available filesystems */
283 status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist); 283 status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist);
284 if (status<0) 284 if (status<0)
285 error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno)); 285 perror_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS");
286 286
287 /* Walk the list trying to mount filesystems 287 /* Walk the list trying to mount filesystems
288 * that do not claim to be nodev filesystems */ 288 * that do not claim to be nodev filesystems */
@@ -307,8 +307,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
307 307
308 if (status == FALSE) { 308 if (status == FALSE) {
309 if (whineOnErrors == TRUE) { 309 if (whineOnErrors == TRUE) {
310 error_msg("Mounting %s on %s failed: %s\n", 310 perror_msg("Mounting %s on %s failed", blockDevice, directory);
311 blockDevice, directory, strerror(errno));
312 } 311 }
313 return (FALSE); 312 return (FALSE);
314 } 313 }
@@ -340,18 +339,18 @@ extern int mount_main(int argc, char **argv)
340 /* open device */ 339 /* open device */
341 fd = open(device, O_RDONLY); 340 fd = open(device, O_RDONLY);
342 if (fd < 0) 341 if (fd < 0)
343 error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); 342 perror_msg_and_die("open failed for `%s'", device);
344 343
345 /* How many mounted filesystems? We need to know to 344 /* How many mounted filesystems? We need to know to
346 * allocate enough space for later... */ 345 * allocate enough space for later... */
347 numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS); 346 numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
348 if (numfilesystems<0) 347 if (numfilesystems<0)
349 error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno)); 348 perror_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS");
350 mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent)); 349 mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent));
351 350
352 /* Grab the list of mounted filesystems */ 351 /* Grab the list of mounted filesystems */
353 if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0) 352 if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
354 error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno)); 353 perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
355 354
356 for( i = 0 ; i < numfilesystems ; i++) { 355 for( i = 0 ; i < numfilesystems ; i++) {
357 fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, 356 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)
453 fstabmount = TRUE; 452 fstabmount = TRUE;
454 453
455 if (f == NULL) 454 if (f == NULL)
456 error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno)); 455 perror_msg_and_die( "\nCannot read /etc/fstab");
457 456
458 while ((m = getmntent(f)) != NULL) { 457 while ((m = getmntent(f)) != NULL) {
459 if (all == FALSE && directory == NULL && ( 458 if (all == FALSE && directory == NULL && (
@@ -487,7 +486,7 @@ singlemount:
487 rc = nfsmount (device, directory, &flags, 486 rc = nfsmount (device, directory, &flags,
488 &extra_opts, &string_flags, 1); 487 &extra_opts, &string_flags, 1);
489 if ( rc != 0) { 488 if ( rc != 0) {
490 error_msg_and_die("nfsmount failed: %s\n", strerror(errno)); 489 perror_msg_and_die("nfsmount failed");
491 rc = EXIT_FAILURE; 490 rc = EXIT_FAILURE;
492 } 491 }
493 } 492 }
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)
47 int fd; 47 int fd;
48 48
49 if (!(h = gethostbyname(host))) { /* get the IP addr */ 49 if (!(h = gethostbyname(host))) { /* get the IP addr */
50 error_msg("%s: %s\n", host, strerror(errno)); 50 perror_msg("%s", host);
51 return(-1); 51 return(-1);
52 } 52 }
53 if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */ 53 if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
54 error_msg("%s: %s\n", "time", strerror(errno)); 54 perror_msg("%s", "time");
55 return(-1); 55 return(-1);
56 } 56 }
57 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */ 57 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
58 error_msg("%s: %s\n", "socket", strerror(errno)); 58 perror_msg("%s", "socket");
59 return(-1); 59 return(-1);
60 } 60 }
61 61
@@ -64,7 +64,7 @@ time_t askremotedate(char *host)
64 sin.sin_family = AF_INET; 64 sin.sin_family = AF_INET;
65 65
66 if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */ 66 if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
67 error_msg("%s: %s\n", host, strerror(errno)); 67 perror_msg("%s", host);
68 close(fd); 68 close(fd);
69 return(-1); 69 return(-1);
70 } 70 }
@@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv)
123 } 123 }
124 if (setdate) { 124 if (setdate) {
125 if (stime(&time) < 0) 125 if (stime(&time) < 0)
126 error_msg_and_die("Could not set time of day: %s\n", strerror(errno)); 126 perror_msg_and_die("Could not set time of day");
127 } 127 }
128 if (printdate) { 128 if (printdate) {
129 fprintf(stdout, "%s", ctime(&time)); 129 fprintf(stdout, "%s", ctime(&time));