X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Ffile-name.c;h=9eeb4b1cfc06309e45c0777ef1277aa0fbeb4894;hb=99732245d610cf363429f1b67a8b2b2e15a9a734;hp=5e4080b11f22ffa463f4bc0264b68de2736abd25;hpb=09648bd73c7511f3c70c941b77f559569edae292;p=pspp-builds.git diff --git a/src/data/file-name.c b/src/data/file-name.c index 5e4080b1..9eeb4b1c 100644 --- a/src/data/file-name.c +++ b/src/data/file-name.c @@ -128,12 +128,16 @@ fn_is_special (const char *file_name) return false; } -/* Returns true if file with name NAME exists. */ +/* Returns true if file with name NAME exists, and that file is not a + directory */ bool fn_exists (const char *name) { struct stat temp; - return stat (name, &temp) == 0; + if ( stat (name, &temp) != 0 ) + return false; + + return ! S_ISDIR (temp.st_mode); } /* Environment variables. */