mount: remove directory if mounting fails
[project/mountd.git] / mount.c
diff --git a/mount.c b/mount.c
index 803acc1..a88ca6d 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -292,8 +292,10 @@ int mount_new(char *path, char *dev)
        pid = waitpid(pid, &ret, 0);
        ret = WEXITSTATUS(ret);
        log_printf("----------> mount ret = %d\n", ret);
-       if(ret && (ret != 0xff))
+       if (ret && ret != 0xff) {
+               rmdir(tmp);
                return -1;
+       }
        if(mount_wait_for_disc(mount->dev) == 0)
        {
                mount->mounted = 1;