btrfs-progs: check: introduce traversal function for fsck
[platform/upstream/btrfs-progs.git] / cmds-balance.c
index e9e388e..f17345e 100644 (file)
@@ -510,7 +510,8 @@ static const char * const cmd_balance_start_usage[] = {
        "-v             be verbose",
        "-f             force reducing of metadata integrity",
        "--full-balance do not print warning and do not delay start",
-       "--background   run the balance as a background process",
+       "--background|--bg",
+       "               run the balance as a background process",
        NULL
 };
 
@@ -540,6 +541,7 @@ static int cmd_balance_start(int argc, char **argv)
                                GETOPT_VAL_FULL_BALANCE },
                        { "background", no_argument, NULL,
                                GETOPT_VAL_BACKGROUND },
+                       { "bg", no_argument, NULL, GETOPT_VAL_BACKGROUND },
                        { NULL, 0, NULL, 0 }
                };
 
@@ -646,7 +648,12 @@ static int cmd_balance_start(int argc, char **argv)
                                "unable to fork to run balance in background");
                                exit(1);
                        case (0):
-                               chdir("/");
+                               /*
+                                * Read the return value to silence compiler
+                                * warning. Change to / should succeed and
+                                * we're not in a security-sensitive context.
+                                */
+                               i = chdir("/");
                                close(0);
                                close(1);
                                close(2);