Created
May 20, 2016 14:54
-
-
Save lucab/861c6d34e706c6a0dd8746a7ccee3361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <errno.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <sys/mount.h> | |
int main(){ | |
char *from = "/tmp/bm-source"; | |
char *to = "/tmp/bm-target"; | |
char *testfile = "/tmp/bm-source/testfile"; | |
int rs1 = remove(from); | |
int rs2 = remove(to); | |
int rs3 = mkdir(from, 0777); | |
int rs5 = close(open(to, O_RDWR|O_CREAT, 0777)); | |
int rs6 = close(open(testfile, O_RDWR|O_CREAT, 0777)); | |
int rs7 = mount(from, to, NULL, MS_BIND, NULL); | |
printf("---\nmount: %s\n---\n", strerror(errno)); | |
return rs7; | |
} |
Author
lucab
commented
May 20, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment