Created
February 13, 2020 10:53
-
-
Save ethercflow/013786e9b2f276da25e61cd1d823712c 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 <unistd.h> | |
#include <errno.h> | |
int main(void) { | |
int ret = 0; | |
while (1) { | |
ret = mount("/dev/sdc", "/mnt", "ext4", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, ""); | |
if (ret < 0) | |
fprintf(stderr, "mount failed: %s\n", strerror(errno)); | |
sleep(1); | |
ret = umount("/mnt"); | |
if (ret < 0) | |
fprintf(stderr, "unmount failed: %s\n", strerror(errno)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment