[parted-devel] [PATCH 2/2] parted: make align-check work in interactive mode
Jim Meyering
jim at meyering.net
Fri May 28 15:10:54 UTC 2010
Petr Uzel wrote:
> On Thu, May 27, 2010 at 03:52:59PM +0200, Jim Meyering wrote:
>> Petr Uzel wrote:
>> > On Thu, May 27, 2010 at 12:01:23PM +0200, Jim Meyering wrote:
>> >>
>> >> > What about the 'FIXME:' part in original patch? It seems to work fine
>> >> > as is, but perhaps I'm missing something...
>> >>
>> >> That return code appears to be unused in interactive mode.
>> >>
>> >
>> > If I'm not mistaken, the return value is propagated to
>> > interactive_mode() (parted/ui.c:1565) and there, based on the
>> > return value, the command_line_flush() is either executed or skipped.
>>
>> That is true.
>> However, does it make a difference?
>
> I don't know :)
> But since all of the do_* functions seem to return 1 on success,
> I'd make do_align_check() consistent, so:
...
> Subject: [PATCH] parted: do_align_check returns always 1 in interactive mode
>
> * parted/parted.c (do_align_check): always return 1 in interactive mode
...
> - /* FIXME: perhaps we should always return 1 when in interactive mode??? */
> - return aligned ? 1 : 0;
> + if (opt_script_mode)
> + return aligned ? 1 : 0;
> + else
> + return 1;
Ok. I'll push that with minor adjustments:
diff --git a/parted/parted.c b/parted/parted.c
index bd31e19..265282a 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2096,8 +2096,10 @@ do_align_check (PedDevice **dev)
if (opt_script_mode)
return aligned ? 1 : 0;
- else
- return 1;
+
+ /* Always return 1 in interactive mode, to be consistent
+ with the other modes. */
+ return 1;
error_destroy_disk:
ped_disk_destroy (disk);
More information about the parted-devel
mailing list