aboutsummaryrefslogtreecommitdiffstats
path: root/remount/remountr.c
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/remountr.c
parentInitial commit (diff)
downloadflxutils-fcb250efba23ae522c4c8cb03c47dd40edcf9603.tar.gz
[RELEASE] flxutils-0.1.4.2v0.1.4.2
Diffstat (limited to 'remount/remountr.c')
-rw-r--r--remount/remountr.c25
1 files changed, 25 insertions, 0 deletions
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);
+}
+