Support Android.

This commit is contained in:
aixiao 2022-03-11 22:22:11 +08:00
parent 65418e9b6b
commit daafec68f5
2 changed files with 22 additions and 3 deletions

View File

@ -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_
}

23
mv.c
View File

@ -22,6 +22,7 @@
#include <sys/types.h>
#include <assert.h>
#include <selinux/selinux.h>
#include <stdlib.h>
#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);