From 603815e03dfdf906ece9fa37af76371667200d18 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 28 Jan 2008 13:13:25 +0100 Subject: [PATCH] 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 --- mount/umount.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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; -- 2.39.5