diff options
author | Karel Zak <kzak@redhat.com> | 2008-01-28 13:13:25 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2008-01-28 13:13:25 +0100 |
commit | 603815e03dfdf906ece9fa37af76371667200d18 (patch) | |
tree | 78b7fc295a0e23835fbabcb0bb3aa640a3e707e1 /mount | |
parent | ff83f99ef6b8adc10a729ac86d4cbf1179166776 (diff) | |
download | util-linux-old-603815e03dfdf906ece9fa37af76371667200d18.tar.gz |
umount: don't print duplicate error messages
umount(8) is trying to umount a device two times to prevent some
obscure scenarios. It's maybe a nice feature, but it also produces
duplicate error messages.
# umount /home
umount: /home: device is busy
umount: /home: device is busy
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r-- | mount/umount.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mount/umount.c b/mount/umount.c index 5b939879..65c8622b 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -77,6 +77,10 @@ int delloop = 0; /* True if ruid != euid. */ int suid = 0; +/* Last error message */ +int complained_err = 0; +char *complained_dev = NULL; + /* * check_special_umountprog() * If there is a special umount program for this type, exec it. @@ -142,6 +146,15 @@ check_special_umountprog(const char *spec, const char *node, /* complain about a failed umount */ static void complain(int err, const char *dev) { + + if (complained_err == err && complained_dev && dev && + strcmp(dev, complained_dev) == 0) + return; + + complained_err = err; + free(complained_dev); + complained_dev = xstrdup(dev); + switch (err) { case ENXIO: error (_("umount: %s: invalid block device"), dev); break; |