Created
July 11, 2018 23:45
-
-
Save aramperes/b793a05f65f65bd23395c51e853c0137 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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <limits.h> | |
#include <sys/mount.h> | |
extern char * ffmount(char *path) | |
{ | |
int rc; | |
char *mountpoint; | |
mountpoint = mkdtemp(path); | |
if (!mountpoint) { | |
return NULL; | |
} | |
rc = mount("tmpfs", mountpoint, "tmpfs", 0, ""); | |
if (rc != 0) { | |
rmdir(mountpoint); | |
return NULL; | |
} | |
return strdup(mountpoint); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment