Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Halo-Michael committed Jun 9, 2021
1 parent d1b6cca commit f46e2e3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mount_bindfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ int main(int argc, char **argv) {
return 1;
}

char *mountpoint = (char *)calloc(MAXPATHLEN, sizeof(char));
if (realpath(argv[0], mountpoint) == NULL)
err(errno, "realpath mountpoint %s", mountpoint);
mountpoint = (char *)realloc(mountpoint, (strlen(mountpoint) + 1) * sizeof(char));

char *dir = (char *)calloc(MAXPATHLEN, sizeof(char));
if (realpath(argv[1], dir) == NULL)
err(errno, "realpath dir %s", dir);
dir = (char *)realloc(dir, (strlen(dir) + 1) * sizeof(char));

char *mountpoint = (char *)calloc(MAXPATHLEN, sizeof(char));
if (realpath(argv[0], mountpoint) == NULL)
err(errno, "realpath mountpoint %s", mountpoint);
mountpoint = (char *)realloc(mountpoint, (strlen(mountpoint) + 1) * sizeof(char));

int mountStatus;
if ((mountStatus = mount("bindfs", dir, mntflags, mountpoint)) < 0) {
if ((mountStatus = mount("bindfs", mountpoint, mntflags, dir)) < 0) {
err(errno, "error on mount(): error = %d", mountStatus);
};

Expand Down

0 comments on commit f46e2e3

Please sign in to comment.