Skip to content

Instantly share code, notes, and snippets.

@oraccha
Created January 27, 2010 07:27
Show Gist options
  • Save oraccha/287628 to your computer and use it in GitHub Desktop.
Save oraccha/287628 to your computer and use it in GitHub Desktop.
/* This program changes the permission of '/dev/null' to 06000. Is it right behavior?
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/mount.h>
int
main()
{
if (mount("/dev/null", "/dev/console", "none", MS_BIND, 0)) {
perror("mount");
return -1;
}
if (chmod("/dev/console", 0600)) {
perror("chmod");
return -1;
}
if (umount("/dev/console")) {
perror("umount");
return -1;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment