New module attribute 'Applicability'.
[gnulib.git] / tests / test-flock.c
index a1872cd..e0147e8 100644 (file)
@@ -14,6 +14,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include <config.h>
+
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/file.h>
 
 #define ASSERT(expr) \
-  do                                                                   \
-    {                                                                  \
-      if (!(expr))                                                     \
-        {                                                              \
-         fprintf (stderr, "%s:%d: assertion failed, errno = %d\n",     \
-                  __FILE__, __LINE__, errno);                          \
-          fflush (stderr);                                             \
-          abort ();                                                    \
-        }                                                              \
-    }                                                                  \
+  do                                                                    \
+    {                                                                   \
+      if (!(expr))                                                      \
+        {                                                               \
+          fprintf (stderr, "%s:%d: assertion failed, errno = %d\n",     \
+                   __FILE__, __LINE__, errno);                          \
+          fflush (stderr);                                              \
+          abort ();                                                     \
+        }                                                               \
+    }                                                                   \
   while (0)
 
 static void
@@ -48,7 +51,7 @@ test_shared (const char *file, int fd)
   ASSERT (fd2 >= 0);
 
   r = flock (fd2, LOCK_SH | LOCK_NB);
-  ASSERT (r == 0);             /* Was able to acquire a second shared lock. */
+  ASSERT (r == 0);              /* Was able to acquire a second shared lock. */
 
   ASSERT (flock (fd, LOCK_UN) == 0);
   ASSERT (close (fd2) == 0);
@@ -66,7 +69,7 @@ test_exclusive (const char *file, int fd)
   ASSERT (fd2 >= 0);
 
   r = flock (fd2, LOCK_SH | LOCK_NB);
-  ASSERT (r == -1);            /* Was unable to acquire a second exclusive lock. */
+  ASSERT (r == -1);             /* Was unable to acquire a second exclusive lock. */
 
   ASSERT (flock (fd, LOCK_UN) == 0);
   ASSERT (close (fd2) == 0);