In data venerdì 12 dicembre 2014 15:03:23, Hu Tao ha scritto:
+static int +umount (char *fs_buf, const mountable_t *fs) +{ + if (fs->type != MOUNTABLE_PATH) { + CLEANUP_FREE char *err = NULL; + if (command (NULL, &err, str_umount, fs_buf, NULL) == -1) { + reply_with_error ("%s", err ? err : "malloc"); + return -1; + } + + if (rmdir (fs_buf) == -1 && errno != ENOENT) { + reply_with_error ("rmdir: %m\n"); + return -1; + } + } + free (fs_buf); + return 0; +}
The only issue with umount is that it does not free fs_buf properly in all the return paths (e.g. when command or rmdir fail). IMHO it'd be better to leave the ownership of that buffer to whatever calls umount (using CLEANUP_FREE to ease that). -- Pino Toscano