aboutsummaryrefslogtreecommitdiff
path: root/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'mount.c')
-rw-r--r--mount.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/mount.c b/mount.c
index 06673f942..8240b99aa 100644
--- a/mount.c
+++ b/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 }