aboutsummaryrefslogtreecommitdiffstats
path: root/remount/remountr.c
blob: f45c39a3d7ec9563ea3e85ce9244c01791ac4f8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
}