rules: fix mmap failure handling
authorRan Benita <ran234@gmail.com>
Thu, 13 Sep 2012 22:09:37 +0000 (01:09 +0300)
committerRan Benita <ran234@gmail.com>
Fri, 14 Sep 2012 18:09:49 +0000 (21:09 +0300)
Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/rules.c

index 0e8e3e7..a619eee 100644 (file)
@@ -1229,9 +1229,9 @@ xkb_components_from_rules(struct xkb_context *ctx,
     }
 
     string = mmap(NULL, stat_buf.st_size, PROT_READ, MAP_SHARED, fd, 0);
-    if (!string) {
-        log_err(ctx, "Couldn't mmap rules file (%zu bytes)\n",
-                (size_t) stat_buf.st_size);
+    if (string == MAP_FAILED) {
+        log_err(ctx, "Couldn't mmap rules file (%lld bytes)\n",
+                (long long) stat_buf.st_size);
         goto err_file;
     }