exec_enable.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 2016 Jeremiah Orians
  2. * This file is part of mescc-tools.
  3. *
  4. * mescc-tools is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * mescc-tools is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with mescc-tools. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <unistd.h>
  20. #include <sys/stat.h>
  21. void file_print(char* s, FILE* f);
  22. int main(int argc, char **argv)
  23. {
  24. /************************************************
  25. * 493 in decimal is 755 in Octal, which is the *
  26. * value we need to set the execute and read *
  27. * bits for all users and the write bit for the *
  28. * Owner of the files *
  29. ************************************************/
  30. int m = 493;
  31. if(2 != argc)
  32. {
  33. file_print("arg count\n", stderr);
  34. exit(EXIT_FAILURE);
  35. }
  36. if(0 != chmod(argv[1], m))
  37. {
  38. file_print("Unable to change permissions\n", stderr);
  39. exit(EXIT_FAILURE);
  40. }
  41. exit(EXIT_SUCCESS);
  42. }