merge of '2b1cc78c259b50ef47b34d85e4f6717f64d1d093'
[openembedded.git] / packages / busybox / busybox-1.6.0 / df_rootfs.patch
1 --- busybox-1.3.1.orig/coreutils/df.c   2006-12-26 22:54:50.000000000 -0600
2 +++ busybox-1.3.1/coreutils/df.c        2006-12-30 00:45:10.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         opt_complementary = "h-km:k-hm:m-hk";
11 @@ -77,7 +78,7 @@
12  
13         do {
14                 const char *device;
15 -               const char *mount_point;
16 +               char *mount_point;
17  
18                 if (mount_table) {
19                         mount_entry = getmntent(mount_table);
20 @@ -116,17 +117,20 @@
21                                                 ) / (blocks_used + s.f_bavail);
22                         }
23  
24 -                       if (strcmp(device, "rootfs") == 0) {
25 -                               continue;
26 -                       } else if (strcmp(device, "/dev/root") == 0) {
27 +                       if (strcmp(device, "/dev/root") == 0 || strcmp(device, "rootfs") == 0) {
28                                 /* Adjusts device to be the real root device,
29                                 * or leaves device alone if it can't find it */
30 -                               device = find_block_device("/");
31 +                               device = find_block_device(mount_point);
32                                 if (!device) {
33                                         goto SET_ERROR;
34                                 }
35                         }
36  
37 +                       if (strcmp(mount_point, "/") == 0) {
38 +                               if (root_done) continue;
39 +                               root_done = 1;
40 +                       }
41 +
42  #ifdef CONFIG_FEATURE_HUMAN_READABLE
43                         printf("%-20s %9s ", device,
44                                 make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));