k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit 7f38565e508689cc1f9d93bfde4dfc0fe22d7a8e
parent a8ae0f14c05f133da22030def1625a78a2f92473
Author: qorg11 <qorg@vxempire.xyz>
Date:   Sat, 22 Aug 2020 09:51:02 +0200

git you're a bit dumb

Diffstat:
Dsrc/mount.c | 45---------------------------------------------
Dsrc/umount.c | 28----------------------------
2 files changed, 0 insertions(+), 73 deletions(-)

diff --git a/src/mount.c b/src/mount.c @@ -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 @@ -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)); - } -}