X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Ffile-name.c;h=fa0eb794010f75b9b2666334c08b827422ed04bd;hb=e9bebe68e0285273d0e37af5d548a9b2c26951e1;hp=2988d50295b073482b3bee10f274834a56bec6d0;hpb=ca0a72e321421d02a1fd6df943425eff4bd1a257;p=pspp diff --git a/src/data/file-name.c b/src/data/file-name.c index 2988d50295..fa0eb79401 100644 --- a/src/data/file-name.c +++ b/src/data/file-name.c @@ -33,6 +33,7 @@ #include "libpspp/version.h" #include "gl/dirname.h" +#include "gl/dosname.h" #include "gl/intprops.h" #include "gl/minmax.h" #include "gl/relocatable.h" @@ -127,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. */ @@ -165,7 +170,7 @@ fn_getenv_default (const char *key, const char *def) static FILE * safety_violation (const char *fn) { - msg (SE, _("Not opening pipe file `%s' because SAFER option set."), fn); + msg (SE, _("Not opening pipe file `%s' because %s option set."), fn, "SAFER"); errno = EPERM; return NULL; }