Thread (24 messages) 24 messages, 3 authors, 2011-11-02
STALE5346d

[PATCH 03/19] Incremental(): Check return value of dev_open() before trying to use it

From: <hidden>
Date: 2011-11-01 15:09:19
Subsystem: the rest · Maintainer: Linus Torvalds

From: Jes Sorensen <redacted>

Signed-off-by: Jes Sorensen <redacted>
---
 Incremental.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/Incremental.c b/Incremental.c
index 3596739..bc5e9d0 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -386,6 +386,12 @@ int Incremental(char *devname, int verbose, int runstop,
 			sprintf(dn, "%d:%d", sra->devs->disk.major,
 				sra->devs->disk.minor);
 			dfd2 = dev_open(dn, O_RDONLY);
+			if (dfd2 < 0) {
+				fprintf(stderr, Name
+					": unable to open %s\n", devname);
+				rv = 2;
+				goto out_unlock;
+			}
 			st2 = dup_super(st);
 			if (st2->ss->load_super(st2, dfd2, NULL) ||
 			    st->ss->compare_super(st, st2) != 0) {
-- 
1.7.6.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help