diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-06-08 12:54:12 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-06-08 12:54:12 +0000 |
commit | 9500a3db906ebfde288593b16132beecea93ee50 (patch) | |
tree | ea9e106c02b962b8755515f74ce12f5fe4c6081a /winsup/utils/mount.cc | |
parent | fe73870ce5c25aec19ad16e64718ed1051f12f0d (diff) | |
download | cygnal-9500a3db906ebfde288593b16132beecea93ee50.tar.gz cygnal-9500a3db906ebfde288593b16132beecea93ee50.tar.bz2 cygnal-9500a3db906ebfde288593b16132beecea93ee50.zip |
mount.cc (error): New function to report an error and exit.
umount.cc (error): Ditto.
(remove_all_automounts): Check return status of cygwin_umount.
(remove_all_user_mounts): Ditto.
(remove_all_system_mounts): Ditto.
Diffstat (limited to 'winsup/utils/mount.cc')
-rw-r--r-- | winsup/utils/mount.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc index 6227eb38e..e41038f4a 100644 --- a/winsup/utils/mount.cc +++ b/winsup/utils/mount.cc @@ -30,6 +30,14 @@ static short force = FALSE; static const char *progname; +static void +error (const char *path) +{ + fprintf (stderr, "%s: %s: %s\n", progname, path, + (errno == EMFILE) ? "Too many mount entries" : strerror (errno)); + exit (1); +} + /* FIXME: do_mount should also print a warning message if the dev arg is a non-existent Win32 path. */ @@ -59,10 +67,7 @@ do_mount (const char *dev, const char *where, int flags) #endif if (mount (dev, where, flags)) - { - perror ("mount failed"); - exit (1); - } + error (where); if (statres == -1) { @@ -159,8 +164,7 @@ main (int argc, const char **argv) if ((force == FALSE) && (mount_already_exists (argv[i + 1], flags))) { errno = EBUSY; - perror ("mount failed"); - exit (1); + error (argv[i + 1]); } else do_mount (argv[i], argv[i + 1], flags); @@ -232,10 +236,7 @@ change_cygdrive_prefix (const char *new_prefix, int flags) flags |= MOUNT_AUTO; if (mount (NULL, new_prefix, flags)) - { - perror ("mount failed"); - exit (1); - } + error (new_prefix); exit (0); } |