diff options
author | qorg11 <qorg@vxempire.xyz> | 2020-08-22 09:51:02 +0200 |
---|---|---|
committer | qorg11 <qorg@vxempire.xyz> | 2020-08-22 09:51:02 +0200 |
commit | 7f38565e508689cc1f9d93bfde4dfc0fe22d7a8e (patch) | |
tree | 7ab6df59d399b6d7f7b2de66f2147012711d9acb | |
parent | a8ae0f14c05f133da22030def1625a78a2f92473 (diff) | |
download | k9core-7f38565e508689cc1f9d93bfde4dfc0fe22d7a8e.tar.gz k9core-7f38565e508689cc1f9d93bfde4dfc0fe22d7a8e.zip |
git you're a bit dumb
-rw-r--r-- | src/mount.c | 45 | ||||
-rw-r--r-- | src/umount.c | 28 |
2 files changed, 0 insertions, 73 deletions
diff --git a/src/mount.c b/src/mount.c deleted file mode 100644 index 1c39f6d..0000000 --- a/src/mount.c +++ /dev/null @@ -1,45 +0,0 @@ -#include <stdio.h> -#include <sys/mount.h> -#include <unistd.h> -#include <getopt.h> -#include <errno.h> -#include <string.h> - -/* Do NOT use this unironically for now, this only supports ext4, and - * you cannot specify another filesystem unless you change the source - * code. */ - -/* Update: now this supports filetype with -t flag. But I still don't - * recommend it to mounting something that it's not extx - */ - -int -main(int argc, char *argv[]) { - int c = getopt(argc, argv,"t:"); - if(argc < 2) - { - printf("./mount source destination\n"); - return 1; - } - - if(getuid() != 0) - { - fprintf(stderr,"Only root can run this\n"); - return 1; - } - char filesystem[10] = "ext4"; - int source = 1; - int destination = 2; - if(c == 't') - { - strcpy(filesystem,optarg); - source++; - destination++; - } - int fd = mount(argv[source],argv[destination],filesystem,0,NULL); - if(fd == -1) - { - fprintf(stderr,"error mounting: %i = %s\n",errno,strerror(errno)); - } - return 0; -} diff --git a/src/umount.c b/src/umount.c deleted file mode 100644 index 8705d9f..0000000 --- a/src/umount.c +++ /dev/null @@ -1,28 +0,0 @@ -#include <stdio.h> -#include <sys/mount.h> -#include <errno.h> -#include <getopt.h> -#include <string.h> - -int -main(int argc, char *argv[]) -{ - int c = getopt(argc, argv, "f"); - int options = 0; /* No options by default */ - int destination = 1; - if(c == 'f') - { - options = MNT_FORCE; - destination++; - } - if(argc == 1) - { - printf("give a directory\n"); - return 1; - } - int fd = umount2(argv[destination],options); - if(fd == -1) - { - fprintf(stderr,"error umounting: %i = %s\n",errno,strerror(errno)); - } -} |