Created
October 2, 2017 14:42
-
-
Save jasonrogena/880574c58d9691dd50b1ea6dad639a12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <errno.h> | |
#include <unistd.h> | |
int main() { | |
int res; | |
res = sethostid(gethostid()); | |
if (res != 0) { | |
switch (errno) { | |
case EACCES: | |
fprintf(stderr, "Error! No permission to write the" | |
" file used to store the host ID.\n" | |
"Are you root?\n"); | |
break; | |
case EPERM: | |
fprintf(stderr, "Error! The calling process's effective" | |
" user or group ID is not the same as" | |
" its corresponding real ID.\n"); | |
break; | |
default: | |
fprintf(stderr, "Unknown error.\n"); | |
} | |
return 1; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment