Created
February 24, 2020 11:54
-
-
Save ethercflow/d8a0f870bb5654541493f8ddb41635f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <sys/mount.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <unistd.h> | |
int main(void) { | |
int ret; | |
while (1) { | |
ret = mount("/dev/sdc", "/mnt", "ext4", | |
MS_MGC_VAL | MS_RDONLY | MS_NOSUID, ""); | |
if (ret < 0) | |
fprintf(stderr, "%s\n", strerror(errno)); | |
sleep(1); | |
ret = umount("/mnt"); | |
if (ret < 0) | |
fprintf(stderr, "%s\n", strerror(errno)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment