aboutsummaryrefslogtreecommitdiffstats
path: root/remount
diff options
context:
space:
mode:
authorWilly Tarreau <willy@wtap.(none)>2006-07-26 10:46:55 +0200
committerWilly Tarreau <willy@wtap.(none)>2006-07-26 10:46:55 +0200
commitfcb250efba23ae522c4c8cb03c47dd40edcf9603 (patch)
tree3756bd1748842a3f1049d857e8412f148a8741b9 /remount
parentInitial commit (diff)
downloadflxutils-fcb250efba23ae522c4c8cb03c47dd40edcf9603.tar.gz
[RELEASE] flxutils-0.1.4.2v0.1.4.2
Diffstat (limited to 'remount')
-rw-r--r--remount/Makefile12
-rwxr-xr-xremount/remountrbin0 -> 436 bytes
-rw-r--r--remount/remountr.c25
l---------remount/remountw1
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
new file mode 100755
index 0000000..eee0129
--- /dev/null
+++ b/remount/remountr
Binary files differ
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