From 8ed01f637f72eaa50becbba6f9be3273404167d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Tue, 29 Jun 2021 15:57:01 +0200 Subject: [PATCH] fix: add correct error if file cannot be executed --- file-browser/src/file_execute.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/file-browser/src/file_execute.c b/file-browser/src/file_execute.c index f9109a4fc3d28883e7a22fb0809fbae9e862fbe3..c8e2e6cffeb958647e35dfb36f5de681a8df6adf 100644 --- a/file-browser/src/file_execute.c +++ b/file-browser/src/file_execute.c @@ -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); }