diff options
Diffstat (limited to 'remount')
-rw-r--r-- | remount/Makefile | 12 | ||||
-rwxr-xr-x | remount/remountr | bin | 0 -> 436 bytes | |||
-rw-r--r-- | remount/remountr.c | 25 | ||||
l--------- | remount/remountw | 1 |
4 files changed, 38 insertions, 0 deletions
diff --git a/remount/Makefile b/remount/Makefile new file mode 100644 index 0000000..718de45 --- /dev/null +++ b/remount/Makefile @@ -0,0 +1,12 @@ +OBJS=remountr remountw +include ../include/rules.make +CFLAGS+=-fomit-frame-pointer + +remountw : remountr + ln -s $^ $@ + +%: %.c + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< + strip -R .comment -R .note $@ + objdump -h $@ | grep -q '\.data[ ]*00000000' && strip -R .data $@ || true + sstrip $@ diff --git a/remount/remountr b/remount/remountr Binary files differnew file mode 100755 index 0000000..eee0129 --- /dev/null +++ b/remount/remountr diff --git a/remount/remountr.c b/remount/remountr.c new file mode 100644 index 0000000..f45c39a --- /dev/null +++ b/remount/remountr.c @@ -0,0 +1,25 @@ +#include <stdio.h> + +const char mount_str[] = "/bin/mount"; +const char remount_str[] = "remount"; +const char slash_str[] = "/"; +const char ro_str[] = "-ro"; +const char wo_str[] = "-wo"; + +int main (int argc, char **argv) { + char *flag, *mntpnt; + + if (argv[0][strlen(argv[0])-1] == 'w') + flag = wo_str; + else + flag = ro_str; + + setreuid(0, 0); + if (argc > 1) + mntpnt = argv[1]; + else + mntpnt = slash_str; + + return execl(mount_str, mount_str, flag, remount_str, mntpnt, NULL); +} + diff --git a/remount/remountw b/remount/remountw new file mode 120000 index 0000000..5bc7a05 --- /dev/null +++ b/remount/remountw @@ -0,0 +1 @@ +remountr
\ No newline at end of file |