From 1e10f194e8bb9e256f90aea4408d72066c95a3a6 Mon Sep 17 00:00:00 2001 From: afederici <ajf5@illinois.edu> Date: Wed, 18 Nov 2020 20:36:09 -0600 Subject: [PATCH] bug fix --- .DS_Store | Bin 6148 -> 6148 bytes inc/Node.h | 4 ++++ src/main.cpp | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.DS_Store b/.DS_Store index 913c42ef74a0c7c241042ffa91b4b4499f7d93f7..cced00e0cc07be1c2adb00cede0f568aa8b797e6 100644 GIT binary patch delta 14 VcmZoMXffEJ#>B|DS)J*wC;%Wi1Q7rL delta 14 VcmZoMXffEJ#>B|5S)J*wC;%Wc1P}lK diff --git a/inc/Node.h b/inc/Node.h index 43e6965..ddf0dd0 100644 --- a/inc/Node.h +++ b/inc/Node.h @@ -12,6 +12,10 @@ #include <dirent.h> #include <sys/types.h> +#include <stdio.h> +#include <sys/stat.h> +#include <unistd.h> + #include "Messages.h" #include "Modes.h" #include "Member.h" diff --git a/src/main.cpp b/src/main.cpp index 29334e2..adb19ed 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -166,9 +166,9 @@ int main(int argc, char *argv[]) cout << "USAGE: maple maple_exe num_maples sdfs_intermediate_dir sdfs_src_dir" << endl; continue; } - if (FILE *file = fopen(cmdLineInput[1].c_str(), "r")) { - fclose(file); - } else { + struct stat sb; + if (stat(cmdLineInput[1].c_str(), &sb) == 0 && sb.st_mode & S_IXUSR) { cout << endl; } + else { cout << "[MAPLE] " << cmdLineInput[1] << " does not exist locally" << endl; continue; } -- GitLab