merge of 8eaefa4f638dc67e29fb59fca3c6a98e4049eb09
[vuplus_openembedded] / packages / busybox / busybox-1.2.1 / df_rootfs.patch
1 --- busybox-1.2.1/coreutils/df.c.orig   2006-11-11 13:25:00.000000000 -0600
2 +++ busybox-1.2.1/coreutils/df.c        2006-11-11 13:23:15.000000000 -0600
3 @@ -47,6 +47,7 @@
4         struct statfs s;
5         static const char hdr_1k[] = "1k-blocks"; /* default display is kilobytes */
6         const char *disp_units_hdr = hdr_1k;
7 +       int root_done = 0;
8  
9  #ifdef CONFIG_FEATURE_HUMAN_READABLE
10         bb_opt_complementally = "h-km:k-hm:m-hk";
11 @@ -112,16 +113,19 @@
12                                                                            ) / (blocks_used + s.f_bavail);
13                         }
14  
15 -                       if (strcmp(device, "rootfs") == 0) {
16 -                               continue;
17 -                       } else if (strcmp(device, "/dev/root") == 0) {
18 +                       if (strcmp(device, "/dev/root") == 0 || strcmp(device, "rootfs") == 0) {
19                                 /* Adjusts device to be the real root device,
20                                 * or leaves device alone if it can't find it */
21 -                               if ((device = find_block_device("/")) == NULL) {
22 +                               if ((device = find_block_device(mount_point)) == NULL) {
23                                         goto SET_ERROR;
24                                 }
25                         }
26  
27 +                       if (strcmp(mount_point, "/") == 0) {
28 +                               if (root_done) continue;
29 +                               root_done = 1;
30 +                       }
31 +
32  #ifdef CONFIG_FEATURE_HUMAN_READABLE
33                         bb_printf("%-20s %9s ", device,
34                                           make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));