public
Last active

Compile: "gcc -o main main.c" Call: "./main /path/to/some/file/or/directory"

  • Download Gist
main.c
C
1 2 3 4 5 6 7 8 9 10 11 12
#include <stdio.h>
#include <unistd.h>
 
int main (int argc, char** argv) {
char* path = argv[1];
printf ("Checking write permissions for %s:\n", path);
int result = access(path, W_OK);
 
printf ("User %s have write permissions.\n", (result == -1 ? "does NOT" : "DOES"));
 
return 0;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.