diff options
Diffstat (limited to 'mount.c')
-rw-r--r-- | mount.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -132,22 +132,22 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
132 | 132 | ||
133 | specialfile = find_unused_loop_device(); | 133 | specialfile = find_unused_loop_device(); |
134 | if (specialfile == NULL) { | 134 | if (specialfile == NULL) { |
135 | errorMsg("Could not find a spare loop device\n"); | 135 | error_msg("Could not find a spare loop device\n"); |
136 | return (FALSE); | 136 | return (FALSE); |
137 | } | 137 | } |
138 | if (set_loop(specialfile, lofile, 0, &loro)) { | 138 | if (set_loop(specialfile, lofile, 0, &loro)) { |
139 | errorMsg("Could not setup loop device\n"); | 139 | error_msg("Could not setup loop device\n"); |
140 | return (FALSE); | 140 | return (FALSE); |
141 | } | 141 | } |
142 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ | 142 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ |
143 | errorMsg("WARNING: loop device is read-only\n"); | 143 | error_msg("WARNING: loop device is read-only\n"); |
144 | flags &= ~MS_RDONLY; | 144 | flags &= ~MS_RDONLY; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | #endif | 147 | #endif |
148 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); | 148 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
149 | if (errno == EROFS) { | 149 | if (errno == EROFS) { |
150 | errorMsg("%s is write-protected, mounting read-only\n", specialfile); | 150 | error_msg("%s is write-protected, mounting read-only\n", specialfile); |
151 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); | 151 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); |
152 | } | 152 | } |
153 | } | 153 | } |
@@ -173,7 +173,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | if (errno == EPERM) { | 175 | if (errno == EPERM) { |
176 | fatalError("permission denied. Are you root?\n"); | 176 | error_msg_and_die("permission denied. Are you root?\n"); |
177 | } | 177 | } |
178 | 178 | ||
179 | return (FALSE); | 179 | return (FALSE); |
@@ -273,18 +273,18 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
273 | /* open device */ | 273 | /* open device */ |
274 | fd = open(device, O_RDONLY); | 274 | fd = open(device, O_RDONLY); |
275 | if (fd < 0) | 275 | if (fd < 0) |
276 | fatalError("open failed for `%s': %s\n", device, strerror (errno)); | 276 | error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); |
277 | 277 | ||
278 | /* How many filesystems? We need to know to allocate enough space */ | 278 | /* How many filesystems? We need to know to allocate enough space */ |
279 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS); | 279 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS); |
280 | if (numfilesystems<0) | 280 | if (numfilesystems<0) |
281 | fatalError("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno)); | 281 | error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno)); |
282 | fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype)); | 282 | fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype)); |
283 | 283 | ||
284 | /* Grab the list of available filesystems */ | 284 | /* Grab the list of available filesystems */ |
285 | status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist); | 285 | status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist); |
286 | if (status<0) | 286 | if (status<0) |
287 | fatalError("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno)); | 287 | error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno)); |
288 | 288 | ||
289 | /* Walk the list trying to mount filesystems | 289 | /* Walk the list trying to mount filesystems |
290 | * that do not claim to be nodev filesystems */ | 290 | * that do not claim to be nodev filesystems */ |
@@ -309,7 +309,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
309 | 309 | ||
310 | if (status == FALSE) { | 310 | if (status == FALSE) { |
311 | if (whineOnErrors == TRUE) { | 311 | if (whineOnErrors == TRUE) { |
312 | errorMsg("Mounting %s on %s failed: %s\n", | 312 | error_msg("Mounting %s on %s failed: %s\n", |
313 | blockDevice, directory, strerror(errno)); | 313 | blockDevice, directory, strerror(errno)); |
314 | } | 314 | } |
315 | return (FALSE); | 315 | return (FALSE); |
@@ -342,18 +342,18 @@ extern int mount_main(int argc, char **argv) | |||
342 | /* open device */ | 342 | /* open device */ |
343 | fd = open(device, O_RDONLY); | 343 | fd = open(device, O_RDONLY); |
344 | if (fd < 0) | 344 | if (fd < 0) |
345 | fatalError("open failed for `%s': %s\n", device, strerror (errno)); | 345 | error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); |
346 | 346 | ||
347 | /* How many mounted filesystems? We need to know to | 347 | /* How many mounted filesystems? We need to know to |
348 | * allocate enough space for later... */ | 348 | * allocate enough space for later... */ |
349 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS); | 349 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS); |
350 | if (numfilesystems<0) | 350 | if (numfilesystems<0) |
351 | fatalError( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno)); | 351 | error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno)); |
352 | mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent)); | 352 | mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent)); |
353 | 353 | ||
354 | /* Grab the list of mounted filesystems */ | 354 | /* Grab the list of mounted filesystems */ |
355 | if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0) | 355 | if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0) |
356 | fatalError( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno)); | 356 | error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno)); |
357 | 357 | ||
358 | for( i = 0 ; i < numfilesystems ; i++) { | 358 | for( i = 0 ; i < numfilesystems ; i++) { |
359 | fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, | 359 | fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, |
@@ -455,7 +455,7 @@ extern int mount_main(int argc, char **argv) | |||
455 | fstabmount = TRUE; | 455 | fstabmount = TRUE; |
456 | 456 | ||
457 | if (f == NULL) | 457 | if (f == NULL) |
458 | fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno)); | 458 | error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno)); |
459 | 459 | ||
460 | while ((m = getmntent(f)) != NULL) { | 460 | while ((m = getmntent(f)) != NULL) { |
461 | if (all == FALSE && directory == NULL && ( | 461 | if (all == FALSE && directory == NULL && ( |
@@ -488,7 +488,7 @@ singlemount: | |||
488 | rc = nfsmount (device, directory, &flags, | 488 | rc = nfsmount (device, directory, &flags, |
489 | &extra_opts, &string_flags, 1); | 489 | &extra_opts, &string_flags, 1); |
490 | if ( rc != 0) { | 490 | if ( rc != 0) { |
491 | fatalError("nfsmount failed: %s\n", strerror(errno)); | 491 | error_msg_and_die("nfsmount failed: %s\n", strerror(errno)); |
492 | rc = EXIT_FAILURE; | 492 | rc = EXIT_FAILURE; |
493 | } | 493 | } |
494 | } | 494 | } |