summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-04-25 00:48:56 +0200
committerJustus Winter <justus@gnupg.org>2016-04-26 14:49:46 +0200
commitd67a86c9690c2a9984ca6e9f3c376956495897f4 (patch)
tree23e1f2114f7a5c545c8629f6239fbe5d9cc22709
parentafbed6fbf2335476c9ca64aa82d5f591be6c4ded (diff)
libtrivfs: fix error handling
* libtrivfs/times.c (trivfs_set_{a,m}time): Fix error handling.
-rw-r--r--libtrivfs/times.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/libtrivfs/times.c b/libtrivfs/times.c
index 5f08cb18..42e668d7 100644
--- a/libtrivfs/times.c
+++ b/libtrivfs/times.c
@@ -20,29 +20,37 @@
error_t
trivfs_set_atime (struct trivfs_control *cntl)
{
+ error_t err;
struct stat st;
time_value_t atime;
time_value_t mtime;
-
- io_stat (cntl->underlying, &st);
+
+ err = io_stat (cntl->underlying, &st);
+ if (err)
+ return err;
+
mtime.seconds = st.st_mtim.tv_sec;
mtime.microseconds = st.st_mtim.tv_nsec / 1000;
atime.microseconds = -1;
- file_utimes (cntl->underlying, atime, mtime);
- return 0;
+
+ return file_utimes (cntl->underlying, atime, mtime);
}
error_t
trivfs_set_mtime (struct trivfs_control *cntl)
{
+ error_t err;
struct stat st;
time_value_t atime;
time_value_t mtime;
- io_stat (cntl->underlying, &st);
+ err = io_stat (cntl->underlying, &st);
+ if (err)
+ return err;
+
atime.seconds = st.st_atim.tv_sec;
atime.microseconds = st.st_atim.tv_nsec / 1000;
mtime.microseconds = -1;
- file_utimes (cntl->underlying, atime, mtime);
- return 0;
+
+ return file_utimes (cntl->underlying, atime, mtime);
}