[sheepdog] [PATCH] Sheepfs: check NULL pointer return of sheepfs_run_cmd function

Ziye Yang ziye.yang at intel.com
Mon Jul 6 08:45:54 CEST 2015


We do not correctly check the NULL pointer value of sheepfs_run_cmd,
it should be fixed.

Signed-off-by: Ziye Yang <ziye.yang at intel.com>
---
 sheepfs/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheepfs/core.c b/sheepfs/core.c
index 473cbb5..90a589a 100644
--- a/sheepfs/core.c
+++ b/sheepfs/core.c
@@ -408,7 +408,7 @@ int main(int argc, char **argv)
 		exit(1);
 
 	t = sheepfs_run_cmd("dog");
-	if (t && !strlen(t->buf)) {
+	if (!t || (t && !strlen(t->buf))) {
 		fprintf(stderr, "command dog not found\n");
 		exit(1);
 	}



More information about the sheepdog mailing list