#include "libpspp/version.h"
#include "gl/dirname.h"
+#include "gl/dosname.h"
#include "gl/intprops.h"
#include "gl/minmax.h"
#include "gl/relocatable.h"
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);
}
\f
/* Environment variables. */
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;
}