randomconfig fixes
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 9 Aug 2011 20:49:15 +0000 (22:49 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 9 Aug 2011 20:49:15 +0000 (22:49 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c
util-linux/fdisk.c

index 6b30277..e4138ad 100644 (file)
@@ -5519,12 +5519,6 @@ static char **expand_assignments(char **argv, int count)
 }
 
 
-#if BB_MMU
-/* never called */
-void re_execute_shell(char ***to_free, const char *s,
-               char *g_argv0, char **g_argv,
-               char **builtin_argv) NORETURN;
-
 static void switch_off_special_sigs(unsigned mask)
 {
        unsigned sig = 0;
@@ -5544,6 +5538,12 @@ static void switch_off_special_sigs(unsigned mask)
        }
 }
 
+#if BB_MMU
+/* never called */
+void re_execute_shell(char ***to_free, const char *s,
+               char *g_argv0, char **g_argv,
+               char **builtin_argv) NORETURN;
+
 static void reset_traps_to_defaults(void)
 {
        /* This function is always called in a child shell
index 9765586..c0be15a 100644 (file)
@@ -201,6 +201,7 @@ enum action { OPEN_MAIN, TRY_ONLY, CREATE_EMPTY_DOS, CREATE_EMPTY_SUN };
 static void update_units(void);
 #if ENABLE_FEATURE_FDISK_WRITABLE
 static void change_units(void);
+static void reread_partition_table(int leave);
 static void delete_partition(int i);
 static unsigned get_partition(int warn, unsigned max);
 static void list_types(const char *const *sys);
@@ -2542,6 +2543,35 @@ new_partition(void)
 }
 
 static void
+reread_partition_table(int leave)
+{
+       int i;
+
+       printf("Calling ioctl() to re-read partition table\n");
+       sync();
+       /* Users with slow external USB disks on a 320MHz ARM system (year 2011)
+        * report that sleep is needed, otherwise BLKRRPART may fail with -EIO:
+        */
+       sleep(1);
+       i = ioctl_or_perror(dev_fd, BLKRRPART, NULL,
+                       "WARNING: rereading partition table "
+                       "failed, kernel still uses old table");
+#if 0
+       if (dos_changed)
+               printf(
+               "\nWARNING: If you have created or modified any DOS 6.x\n"
+               "partitions, please see the fdisk manual page for additional\n"
+               "information\n");
+#endif
+
+       if (leave) {
+               if (ENABLE_FEATURE_CLEAN_UP)
+                       close_dev_fd();
+               exit(i != 0);
+       }
+}
+
+static void
 write_table(void)
 {
        int i;
@@ -2571,30 +2601,8 @@ write_table(void)
                }
        }
 
-       printf(
-               "The partition table has been altered.\n"
-               "Calling ioctl(BLKRRPART) to re-read partition table.\n"
-       );
-
-       sync();
-       /* Users with slow external USB disks on a 320MHz ARM system (year 2011)
-        * report that sleep is needed, otherwise BLKRRPART may fail with -EIO:
-        */
-       sleep(1);
-       i = ioctl_or_perror(dev_fd, BLKRRPART, NULL,
-                       "WARNING: rereading partition table "
-                       "failed, kernel still uses old table");
-#if 0
-       if (dos_changed)
-               printf(
-               "\nWARNING: If you have created or modified any DOS 6.x\n"
-               "partitions, please see the fdisk manual page for additional\n"
-               "information\n");
-#endif
-
-       if (ENABLE_FEATURE_CLEAN_UP)
-               close_dev_fd();
-       exit(i != 0);
+       printf("The partition table has been altered.\n");
+       reread_partition_table(1);
 }
 #endif /* FEATURE_FDISK_WRITABLE */