[CRIU] [PATCH 6/6] gen-offsets.sh: error out if something goes wrong

Kir Kolyshkin kir at openvz.org
Tue Feb 21 17:09:17 EST 2012


In addition, add target rm if script has failed.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 Makefile       |    4 ++--
 gen-offsets.sh |    3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 23de231..c598e11 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,7 @@ $(HEAD-BIN): $(HEAD-LDS) $(OBJS-BLOB) parasite-util-net.o
 
 $(HEAD-BLOB-GEN): $(HEAD-BIN) $(GEN-OFFSETS)
 	$(E) "  GEN     " $@
-	$(Q) $(SH) $(GEN-OFFSETS) parasite > $@
+	$(Q) $(SH) $(GEN-OFFSETS) parasite > $@ || rm -f $@
 	$(Q) sync
 
 $(ROBJS): $(RSRCS-BLOB)
@@ -102,7 +102,7 @@ $(RHEAD-BIN): $(ROBJS) $(RHEAD-LDS)
 
 $(RHEAD-BLOB-GEN): $(RHEAD-BIN) $(GEN-OFFSETS)
 	$(E) "  GEN     " $@
-	$(Q) $(SH) $(GEN-OFFSETS) restorer > $@
+	$(Q) $(SH) $(GEN-OFFSETS) restorer > $@ || rm -f $@
 	$(Q) sync
 
 %.o: %.c
diff --git a/gen-offsets.sh b/gen-offsets.sh
index 083d4ff..545b6d7 100644
--- a/gen-offsets.sh
+++ b/gen-offsets.sh
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+set -e
+set -u
+
 NAME=$1
 INC_GUARD=__${NAME}_h__
 PREFIX=${NAME}_blob_offset__
-- 
1.7.7.6



More information about the CRIU mailing list