Skip to content

Commit

Permalink
wmediumd: check for root permission when necessary
Browse files Browse the repository at this point in the history
Fix issue #1
  • Loading branch information
jlopex committed Oct 7, 2013
1 parent 6dd198c commit 6ead225
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions wmediumd/wmediumd.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,13 @@ void print_help(int exval)
exit(exval);
}

void check_root_permission ()
{
if (getuid()) {
printf("wmediumd: this mode requires root permission\n");
exit(EXIT_FAILURE);
}
}

int main(int argc, char* argv[]) {

Expand All @@ -436,6 +443,8 @@ int main(int argc, char* argv[]) {
exit(EXIT_SUCCESS);
break;
case 'c':
/* Root permission is required */
check_root_permission();
printf("Input configuration file: %s\n", optarg);
load_config(optarg);
break;
Expand Down

0 comments on commit 6ead225

Please sign in to comment.