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

login
register
mail settings
Submitter Tomas Racek
Date March 16, 2013, 9:13 a.m.
Message ID <1363425205-10970-3-git-send-email-tracek@redhat.com>
Download mbox | patch
Permalink /patch/228203/
State Accepted
Headers show

Comments

Tomas Racek - March 16, 2013, 9:13 a.m.
All data cannot be included in normal image file so e2image should exit
in this case.

Signed-off-by: Tomas Racek <tracek@redhat.com>
---
 misc/e2image.c | 7 +++++++
 1 file changed, 7 insertions(+)
Eric Sandeen - March 18, 2013, 3:42 p.m.
On 3/16/13 4:13 AM, Tomas Racek wrote:
> All data cannot be included in normal image file so e2image should exit
> in this case.
> 
> Signed-off-by: Tomas Racek <tracek@redhat.com>
> ---
>  misc/e2image.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/misc/e2image.c b/misc/e2image.c
> index 6988c4d..b4e4cf9 100644
> --- a/misc/e2image.c
> +++ b/misc/e2image.c
> @@ -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:

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> +		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];
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - April 22, 2013, 3:23 a.m.
On Sat, Mar 16, 2013 at 10:13:25AM +0100, Tomas Racek wrote:
> All data cannot be included in normal image file so e2image should exit
> in this case.
> 
> Signed-off-by: Tomas Racek <tracek@redhat.com>

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

		     	 	    	- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/misc/e2image.c b/misc/e2image.c
index 6988c4d..b4e4cf9 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -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];