Skip to content

Commit

Permalink
Update main.c
Browse files Browse the repository at this point in the history
Added check at top of main() to test if user is running as sudo.  Print message and exit if not run as sudo.
  • Loading branch information
tmcolby committed Jan 5, 2015
1 parent dc910bf commit 479ce05
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions usbboot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ int main(int argc, char *argv[])
int length;
unsigned char signature[20];
} message;

//exit if not run as sudo
int user = getuid();
if(user != 0)
{
printf("Must be run with sudo...\n");
exit(-1);
}

// Skip the command name
argv++; argc--;
Expand Down

0 comments on commit 479ce05

Please sign in to comment.