Don't assume that EOPNOTSUPP exists.
authorBruno Haible <bruno@clisp.org>
Tue, 20 Jan 2009 23:29:53 +0000 (00:29 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 20 Jan 2009 23:29:53 +0000 (00:29 +0100)
ChangeLog
tests/test-link.c

index 8ebd4aa..521eb24 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-20  Bruno Haible  <bruno@clisp.org>
+
+       Fix compilation failure on mingw.
+       * tests/test-link.c (main): Don't assume that EOPNOTSUPP exists.
+
 2009-01-20  Michael Gold  <mgold@ncf.ca>  (tiny change)
 
        * doc/c-strtod.texi: Mention a couple of restrictions.
index a358921..250a821 100644 (file)
@@ -46,10 +46,17 @@ main (int argc, char **argv)
     {
       /* If the device does not support hard links, errno is
         EPERM on Linux, EOPNOTSUPP on FreeBSD.  */
-      if (errno == EPERM || errno == EOPNOTSUPP)
-       return 77;
-      perror ("link");
-      return 1;
+      switch (errno)
+       {
+       case EPERM:
+#ifdef EOPNOTSUPP
+       case EOPNOTSUPP:
+#endif
+         return 77;
+       default:
+         perror ("link");
+         return 1;
+       }
     }
 
   return 0;