summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2020-08-31 13:46:51 +0000
committerStefan Schmidt <stefan@datenfreihafen.org>2020-09-01 09:35:46 +0200
commit2261332969b6e97aa302ee1663b3626c7378d9ad (patch)
treed26dabd46f1e77df3033a652a75ca6db1e0f6a3b
parentb89f1cc0a312a4b9ced4f03d2e8f09b8a809b34f (diff)
ecore_file_can_exec: fix .bat case
the test on the .bat file was too early Reviewed-by: João Paulo Taylor Ienczak Zanette <joao.tiz@expertisesolutions.com.br> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D12122
-rw-r--r--src/lib/ecore_file/ecore_file.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c
index 528de6a97a..83fca2600e 100644
--- a/src/lib/ecore_file/ecore_file.c
+++ b/src/lib/ecore_file/ecore_file.c
@@ -643,7 +643,7 @@ ecore_file_can_exec(const char *file)
643 h = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, 643 h = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL,
644 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 644 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
645 if (h == INVALID_HANDLE_VALUE) 645 if (h == INVALID_HANDLE_VALUE)
646 return EINA_FALSE; 646 goto test_bat;
647 647
648 if (!GetFileSizeEx(h, &sz)) 648 if (!GetFileSizeEx(h, &sz))
649 goto close_h; 649 goto close_h;
@@ -697,16 +697,16 @@ ecore_file_can_exec(const char *file)
697 */ 697 */
698 if ((characteristics & 0x0002) && !(characteristics & 0x2000)) 698 if ((characteristics & 0x0002) && !(characteristics & 0x2000))
699 return EINA_TRUE; 699 return EINA_TRUE;
700 700 unmap_view:
701 UnmapViewOfFile(base);
702 close_h:
703 CloseHandle(h);
704 test_bat:
701 /* 705 /*
702 * a .bat file, considered as an executable, is only a text file, 706 * a .bat file, considered as an executable, is only a text file,
703 * so we rely on the extension. Not the best but we cannot do more. 707 * so we rely on the extension. Not the best but we cannot do more.
704 */ 708 */
705 return eina_str_has_extension(file, ".bat"); 709 return eina_str_has_extension(file, ".bat");
706 unmap_view:
707 UnmapViewOfFile(base);
708 close_h:
709 CloseHandle(h);
710#else 710#else
711 if (!access(file, X_OK)) return EINA_TRUE; 711 if (!access(file, X_OK)) return EINA_TRUE;
712#endif 712#endif