Skip to contentSkip to conversation

e2image: Remove useless exit call

PATCH Applied Tomas Racek 3 participants 7 messages Mar 16, 2013 – Apr 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 e2image: Remove useless exit call

Exit is called right after the install_image anyway so this one can be removed.

---
 misc/e2image.c | 1 -
 1 file changed, 1 deletion(-)
misc/e2image.c +0 -1
index b1badda..6988c4d 100644
@@ -1230,7 +1230,6 @@ static void install_image(char *device, char *image_fn, int type)
 	}
 
 	ext2fs_close (fs);
-	exit (0);
 }
 
 static struct ext2_qcow2_hdr *check_qcow2_image(int *fd, char *name)
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 2/3 e2image: man: fix typo

---
 misc/e2image.8.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
misc/e2image.8.in +1 -1
index 0972826..84b9729 100644
@@ -187,7 +187,7 @@ Normally
 only includes fs metadata, not regular file data.  The
 .B \-a
 option can be specified to include all data.  This will
-give an image that is suitible to use to clone the entire FS or
+give an image that is suitable to use to clone the entire FS or
 for backup purposes.  Note that this option only works with the
 raw or QCOW2 formats.
 .PP
Signature · 1 line
1.7.11.7
#3 lore raw

PATCH 3/3 e2image: require that -a option is used only with raw or QCOW2 image

In reply to Tomas Racek

All data cannot be included in normal image file so e2image should exit in this case.

---
 misc/e2image.c | 7 +++++++
 1 file changed, 7 insertions(+)
misc/e2image.c +7 -0
index 6988c4d..b4e4cf9 100644
@@ -1295,6 +1295,13 @@ int main (int argc, char ** argv)
 		}
 	if (optind != argc - 2 )
 		usage();
+
+	if(all_data && !img_type) {
+		com_err(program_name, 0, "-a option can only be used "
+					 "with raw or QCOW2 images.");
+		exit(1);
+	}
+
 	device_name = argv[optind];
 	image_fn = argv[optind+1];
 
Signature · 1 line
1.7.11.7
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] e2image: require that -a option is used only with raw or QCOW2 image

Quoted 13 lines · Tomas Racek

All data cannot be included in normal image file so e2image should exit in this case.

---
 misc/e2image.c | 7 +++++++
 1 file changed, 7 insertions(+)
misc/e2image.c +0 -0
index 6988c4d..b4e4cf9 100644

misc/e2image.c int main (int argc, char ** argv) · line 1299

Quoted 5 lines
misc/e2image.c +2 -0
@@ -1295,6 +1295,13 @@ int main (int argc, char ** argv)
 		}
 	if (optind != argc - 2 )
 		usage();
+
+	if(all_data && !img_type) {
          ^

nitpick, add space. Can probably be fixed on merge, otherwise:

Also - what is the result today if -a is specified w/o -r or -Q?

The change itself looks good, though, so:

Quoted 9 lines
misc/e2image.c +5 -0
+		com_err(program_name, 0, "-a option can only be used "
+					 "with raw or QCOW2 images.");
+		exit(1);
+	}
+
 	device_name = argv[optind];
 	image_fn = argv[optind+1];
 
#5 lore raw

Re: [PATCH 3/3] e2image: require that -a option is used only with raw or QCOW2 image

In reply to Tomas Racek
Quoted 4 lines · Tomas Racek

All data cannot be included in normal image file so e2image should exit in this case.

Thanks, applied with the whitespace nit which Eric pointed out fixed.

- Ted