summaryrefslogtreecommitdiff
path: root/debian/patches/fixes0001-libtrivfs-fix-error-handling.patch
blob: 2fc273c871b77eed6d111d2386eed6ab41e3f68e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From f34b08c96d323403bb5f186c90181b9b21caf935 Mon Sep 17 00:00:00 2001
From: Justus Winter <justus@gnupg.org>
Date: Mon, 25 Apr 2016 00:48:56 +0200
Subject: [PATCH hurd 1/5] libtrivfs: fix error handling

* libtrivfs/times.c (trivfs_set_{a,m}time): Fix error handling.
---
 libtrivfs/times.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/libtrivfs/times.c b/libtrivfs/times.c
index 5f08cb1..42e668d 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);
 }
-- 
2.1.4