~ruther/CTU-FEE-B0B35APO-Semestral-project

8ed01f637f72eaa50becbba6f9be3273404167d0 — František Boháček 4 years ago 4c11038
fix: add correct error if file cannot be executed
1 files changed, 9 insertions(+), 3 deletions(-)

M file-browser/src/file_execute.c
M file-browser/src/file_execute.c => file-browser/src/file_execute.c +9 -3
@@ 36,9 36,15 @@ executing_file_error_t executing_file_execute(char *path, char *args) {

    execl(path, path, args, (char*)NULL);

    // Is reached only in case of an error
    fprintf(stderr, "Could not execute file: %s\r\n",
            fileaccess_get_error_text(file_operation_error_from_errno(errno)));
    if (errno == EPERM) {
      fprintf(stderr, "Could not execute file: file is not executable\r\n");
      exit(errno);
    }

      // Is reached only in case of an error
    fprintf(
          stderr, "Could not execute file \"%s %s\": %s\r\n", path, args,
          fileaccess_get_error_text(file_operation_error_from_errno(errno)));
    exit(errno);
  }