mdev: fix breakage caused by unified parser usage
[oweals/busybox.git] / util-linux / umount.c
index 6136fa97cd4c87e7154d002c7d6f73a5ad91c7fc..0662cea1b48c4e6b3c4db6cfe4910731c6d39b3d 100644 (file)
@@ -9,9 +9,19 @@
  */
 
 #include <mntent.h>
-#include <getopt.h>
 #include "libbb.h"
 
+#if defined(__dietlibc__)
+/* 16.12.2006, Sampo Kellomaki (sampo@iki.fi)
+ * dietlibc-0.30 does not have implementation of getmntent_r() */
+static struct mntent *getmntent_r(FILE* stream, struct mntent* result,
+               char* buffer UNUSED_PARAM, int bufsize UNUSED_PARAM)
+{
+       struct mntent* ment = getmntent(stream);
+       return memcpy(result, ment, sizeof(*ment));
+}
+#endif
+
 /* ignored: -v -d -t -i */
 #define OPTION_STRING           "fldnra" "vdt:i"
 #define OPT_FORCE               (1 << 0)
@@ -27,7 +37,7 @@
 //#define MNT_DETACH 0x00000002 /* Just detach from the tree */
 
 int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int umount_main(int argc ATTRIBUTE_UNUSED, char **argv)
+int umount_main(int argc UNUSED_PARAM, char **argv)
 {
        int doForce;
        char *const path = xmalloc(PATH_MAX + 2); /* to save stack */
@@ -59,7 +69,7 @@ int umount_main(int argc ATTRIBUTE_UNUSED, char **argv)
        fp = setmntent(bb_path_mtab_file, "r");
        if (!fp) {
                if (opt & OPT_ALL)
-                       bb_error_msg_and_die("cannot open %s", bb_path_mtab_file);
+                       bb_error_msg_and_die("can't open %s", bb_path_mtab_file);
        } else {
                while (getmntent_r(fp, &me, path, PATH_MAX)) {
                        /* Match fstype if passed */
@@ -122,13 +132,13 @@ int umount_main(int argc ATTRIBUTE_UNUSED, char **argv)
                                const char *msg = "%s busy - remounted read-only";
                                curstat = mount(m->device, zapit, NULL, MS_REMOUNT|MS_RDONLY, NULL);
                                if (curstat) {
-                                       msg = "cannot remount %s read-only";
+                                       msg = "can't remount %s read-only";
                                        status = EXIT_FAILURE;
                                }
                                bb_error_msg(msg, m->device);
                        } else {
                                status = EXIT_FAILURE;
-                               bb_perror_msg("cannot %sumount %s", (doForce ? "forcibly " : ""), zapit);
+                               bb_perror_msg("can't %sumount %s", (doForce ? "forcibly " : ""), zapit);
                        }
                } else {
                        // De-allocate the loop device.  This ioctl should be ignored on