From 11230acab97635104ea0133ff55253f71b103ff4 Mon Sep 17 00:00:00 2001 From: Alex Baines Date: Wed, 4 Jan 2017 17:03:22 +0000 Subject: [PATCH] linux: fix for opening relative paths via cmdline --- linux_4ed.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/linux_4ed.cpp b/linux_4ed.cpp index ceaaa425..33d754cd 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -455,6 +455,11 @@ Sys_Get_Canonical_Sig(system_get_canonical){ char* write_p = path; const char* read_p = filename; + // return 0 for relative paths (e.g. cmdline args) + if(len > 0 && filename[0] != '/'){ + return 0; + } + while(read_p < filename + len){ if(read_p == filename || read_p[0] == '/'){ if(read_p[1] == '/'){ @@ -529,9 +534,11 @@ Sys_Load_File_Sig(system_load_file){ int fd = *(int*)&handle; do { ssize_t n = read(fd, buffer, size); - if(n == -1 && errno != EAGAIN){ - perror("read"); - break; + if(n == -1){ + if(errno != EINTR){ + perror("read"); + break; + } } else { size -= n; buffer += n;