summaryrefslogtreecommitdiff
path: root/libshouldbeinlibc/maptime.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-11-20 13:19:36 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2013-11-21 10:29:54 +0100
commit5e3d2fc37be8b73a0ddabf1389c75f79e77c7e93 (patch)
treeeb3ea88c95ae0292c595247e6705b58dafa15aac /libshouldbeinlibc/maptime.c
parentae2434732c4b24d1b91ab30615e79f48bd40b9b5 (diff)
libshouldbeinlibc: fix error handling in maptime_map
Found using the Clang Static Analyzer. * libshouldbeinlibc/maptime.c (maptime_map): Fix error handling.
Diffstat (limited to 'libshouldbeinlibc/maptime.c')
-rw-r--r--libshouldbeinlibc/maptime.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libshouldbeinlibc/maptime.c b/libshouldbeinlibc/maptime.c
index 971e05f7..ca35c6cf 100644
--- a/libshouldbeinlibc/maptime.c
+++ b/libshouldbeinlibc/maptime.c
@@ -42,13 +42,13 @@ maptime_map (int use_mach_dev, char *dev_name,
mach_port_t device_master;
err = get_privileged_ports (0, &device_master);
- if (! err)
- {
- err = device_open (device_master, 0, dev_name ?: "time", &device);
- mach_port_deallocate (mach_task_self (), device_master);
- if (err)
- return err;
- }
+ if (err)
+ return err;
+
+ err = device_open (device_master, 0, dev_name ?: "time", &device);
+ mach_port_deallocate (mach_task_self (), device_master);
+ if (err)
+ return err;
err = device_map (device, VM_PROT_READ, 0, sizeof *mtime, &memobj, 0);
}