tests: Fix creating remove_cmd.
authorAndreas Schneider <asn@samba.org>
Thu, 10 Apr 2014 08:23:14 +0000 (10:23 +0200)
committerAndreas Schneider <asn@samba.org>
Mon, 14 Apr 2014 13:28:46 +0000 (15:28 +0200)
Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
tests/test_ioctl.c

index 86734cf834682e45004aba460c96ebbf1a8158a1..077e5531315517f6283b6e59cf9ad1d9df0bc32d 100644 (file)
@@ -37,9 +37,10 @@ static void teardown(void **state)
 
        (void) state; /* unused */
 
-       if (swrap_dir != NULL) {
-               snprintf(remove_cmd, sizeof(remove_cmd), "rm -rf %s", swrap_dir);
+       if (swrap_dir == NULL) {
+               return;
        }
+       snprintf(remove_cmd, sizeof(remove_cmd), "rm -rf %s", swrap_dir);
 
        rc = system(remove_cmd);
        if (rc < 0) {