linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jon ernst <jonernst07@gmail.com>
To: "linux-ext4@vger.kernel.org List" <linux-ext4@vger.kernel.org>
Cc: jon ernst <jonernst07@gmail.com>
Subject: [PATCH 1/1] handle e2image offset value better
Date: Sun, 5 Jan 2014 04:42:42 +0000	[thread overview]
Message-ID: <CAGW2f1ES7Gji4hXEeMzCSdH3VabXU7SeD-4cg4GL6K9ArugwHw@mail.gmail.com> (raw)

current e2image cannot handle offset value as 0.

For example,
e2image -aro   0 /dev/sda7 ~/e2image7
will return usage()
but
e2image -aro   1 /dev/sda7 ~/e2image7
is fine.


Signed-off-by: "Jon Ernst" <jonernst07@gmail.com>
---
 misc/e2image.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/misc/e2image.c b/misc/e2image.c
index 74515c8..af97d7a 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -1485,9 +1485,11 @@ int main (int argc, char ** argv)
             break;
         case 'o':
             source_offset = strtoull(optarg, NULL, 0);
+            move_mode = 1;
             break;
         case 'O':
             dest_offset = strtoull(optarg, NULL, 0);
+            move_mode = 1;
             break;
         case 'p':
             show_progress = 1;
@@ -1498,10 +1500,7 @@ int main (int argc, char ** argv)
         default:
             usage();
         }
-    if (optind == argc - 1 &&
-        (source_offset || dest_offset))
-            move_mode = 1;
-    else if (optind != argc - 2 )
+    if ((optind != argc - 2 ) && (move_mode))
         usage();

     if (all_data && !img_type) {
-- 
1.8.3.2

             reply	other threads:[~2014-01-05  4:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-05  4:42 jon ernst [this message]
2014-01-11 18:43 ` [1/1] handle e2image offset value better Theodore Ts'o
2014-01-11 20:08   ` jon ernst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGW2f1ES7Gji4hXEeMzCSdH3VabXU7SeD-4cg4GL6K9ArugwHw@mail.gmail.com \
    --to=jonernst07@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).