btrfs-progs: balance: silence compiler warning
authorDavid Sterba <dsterba@suse.com>
Tue, 26 Jul 2016 17:11:42 +0000 (19:11 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Jul 2016 17:27:41 +0000 (19:27 +0200)
cmds-balance.c: In function 'cmd_balance_start':
cmds-balance.c:654:6: warning: ignoring return value of 'chdir', declared with
attribute warn_unused_result [-Wunused-result]
chdir("/");

Reported-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-balance.c

index e9e388e..c9f1288 100644 (file)
@@ -646,7 +646,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);