Skip to content

Instantly share code, notes, and snippets.

@ethercflow
Created February 24, 2020 11:54
Show Gist options
  • Save ethercflow/d8a0f870bb5654541493f8ddb41635f8 to your computer and use it in GitHub Desktop.
Save ethercflow/d8a0f870bb5654541493f8ddb41635f8 to your computer and use it in GitHub Desktop.
#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