summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-08-06 20:27:03 +0200
committerJustus Winter <justus@gnupg.org>2017-08-06 20:28:02 +0200
commit0a68ce9956efcc286d359907b0e5599eb5a404ec (patch)
tree09500b86977e64e4d5bd9fafef1cb1fe3bcfcca0 /libdiskfs
parent94202d376102f6368260aeb0a26bed5b0be52fe5 (diff)
libdiskfs: Make mapping the time device more robust.
* libdiskfs/init-init.c (diskfs_init_diskfs): First try /dev/time, then fall back to the Mach device.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/init-init.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libdiskfs/init-init.c b/libdiskfs/init-init.c
index 357960b8..e642c2e5 100644
--- a/libdiskfs/init-init.c
+++ b/libdiskfs/init-init.c
@@ -69,14 +69,16 @@ diskfs_init_diskfs (void)
diskfs_default_pager = MACH_PORT_NULL;
err = vm_set_default_memory_manager (host, &diskfs_default_pager);
mach_port_deallocate (mach_task_self (), host);
-
- if (!err)
- err = maptime_map (1, 0, &diskfs_mtime);
}
+ if (err)
+ return err;
}
- else
- err = maptime_map (0, 0, &diskfs_mtime);
+ /* First try to use /dev/time... */
+ err = maptime_map (0, NULL, &diskfs_mtime);
+ if (err)
+ /* ... and fall back to the Mach time device. */
+ err = maptime_map (1, NULL, &diskfs_mtime);
if (err)
return err;