diff --git a/build_mv.sh b/build_mv.sh index 4edfd16..33d5ef0 100644 --- a/build_mv.sh +++ b/build_mv.sh @@ -39,8 +39,8 @@ function MV() { gcc -g -O2 -Wl,--as-needed -o mv \ mv.o remove.o copy.o cp-hash.o extent-scan.o force-link.o selinux.o libver.a lib/libcoreutils.a lib/libcoreutils.a \ -lselinux -lacl -lattr -pthread -lpcre2-8 -ldl -static - mv ./mv rm_ + strip ./rm_ } diff --git a/mv.c b/mv.c index 223655d..3ef483d 100644 --- a/mv.c +++ b/mv.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "system.h" #include "backupfile.h" @@ -373,10 +374,28 @@ main (int argc, char **argv) } } + char mkdir_s[270]; + strcpy(mkdir_s, "mkdir -p "); + strcat(mkdir_s, s); + //printf("%s\n", mkdir_s); - argvs[argc] = s; + if (!access(s, 0)) { + ;//printf("%s EXISITS!\n", s); + } + else + { + printf("%s DOESN'T EXISIT!\n", s); + if (-1 == system("mount -o remount,rw /")) { + perror("system"); + } + if (-1 == system(mkdir_s)) { + perror("system"); + } + } + + argvs[argc] = s; char **p9; - p9 = &argvs; + p9 = &(argvs[0]); argc = argc + 1; initialize_main (&argc, &argvs);