get_default_paper_size: Use access instead of fn_exists
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 31 Oct 2015 11:56:42 +0000 (12:56 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 31 Oct 2015 11:56:42 +0000 (12:56 +0100)
The latter has portability problems.  Also access checks that the file is readable not only
that it exists.

src/output/measure.c

index 358958550199c43f148ba638f9afcf2e56eab03a..c352de66d22be708bc0febefe202b7dc5431eec3 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "output/measure.h"
 
+#include <unistd.h>
 #include <gl/c-strtod.h>
 #include <ctype.h>
 #include <errno.h>
@@ -27,7 +28,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 
-#include "data/file-name.h"
 #include "libpspp/str.h"
 
 #include "gl/c-strcase.h"
@@ -308,7 +308,7 @@ get_default_paper_size (int *h, int *v)
 #endif
 
   /* libpaper defaults to /etc/papersize. */
-  if (fn_exists ("/etc/papersize"))
+  if (0 == access ("/etc/papersize", R_OK))
     return read_paper_conf ("/etc/papersize", h, v);
 
   /* Can't find a default. */