Remove unused function
[pspp] / src / data / file-name.c
index 5e4080b11f22ffa463f4bc0264b68de2736abd25..3e9fa6914a72d3a5dcc8e011bbcde94d274a782e 100644 (file)
@@ -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);
 }
 \f
 /* Environment variables. */
@@ -166,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;
 }
@@ -246,29 +250,6 @@ fn_close (const char *fn, FILE *f)
     return fclose (f);
 }
 
-/* Creates a new file named FN with the given PERMISSIONS bits,
-   and returns a stream for it or a null pointer on failure.
-   MODE should be "w" or "wb". */
-FILE *
-create_stream (const char *fn, const char *mode, mode_t permissions)
-{
-  int fd;
-  FILE *stream;
-
-  fd = open (fn, O_WRONLY | O_CREAT | O_TRUNC, permissions);
-  if (fd < 0)
-    return NULL;
-
-  stream = fdopen (fd, mode);
-  if (stream == NULL)
-    {
-      int save_errno = errno;
-      close (fd);
-      errno = save_errno;
-    }
-
-  return stream;
-}
 
 /* A file's identity: