* [PATCH] sfdisk: exit with error if rereading partition table fails
@ 2016-04-21 7:24 Victor Dodon
2016-04-21 8:44 ` Karel Zak
2016-05-05 9:45 ` Karel Zak
0 siblings, 2 replies; 3+ messages in thread
From: Victor Dodon @ 2016-04-21 7:24 UTC (permalink / raw)
To: util-linux; +Cc: Victor Dodon
Use the return value of fdisk_reread_partition_table in write_changes so that
sfdisk exits with error if re-reading the partition table fails.
Signed-off-by: Victor Dodon <dodonvictor@gmail.com>
---
disk-utils/sfdisk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 15fa99c..b520c9b 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -534,7 +534,7 @@ static int write_changes(struct sfdisk *sf)
rc = move_partition_data(sf, sf->partno, sf->orig_pa);
if (!rc) {
fdisk_info(sf->cxt, _("\nThe partition table has been altered."));
- fdisk_reread_partition_table(sf->cxt);
+ rc = fdisk_reread_partition_table(sf->cxt);
}
}
if (!rc)
--
2.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sfdisk: exit with error if rereading partition table fails
2016-04-21 7:24 [PATCH] sfdisk: exit with error if rereading partition table fails Victor Dodon
@ 2016-04-21 8:44 ` Karel Zak
2016-05-05 9:45 ` Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2016-04-21 8:44 UTC (permalink / raw)
To: Victor Dodon; +Cc: util-linux
On Thu, Apr 21, 2016 at 12:24:58AM -0700, Victor Dodon wrote:
> Use the return value of fdisk_reread_partition_table in write_changes so that
> sfdisk exits with error if re-reading the partition table fails.
>
> Signed-off-by: Victor Dodon <dodonvictor@gmail.com>
> ---
> disk-utils/sfdisk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
> index 15fa99c..b520c9b 100644
> --- a/disk-utils/sfdisk.c
> +++ b/disk-utils/sfdisk.c
> @@ -534,7 +534,7 @@ static int write_changes(struct sfdisk *sf)
> rc = move_partition_data(sf, sf->partno, sf->orig_pa);
> if (!rc) {
> fdisk_info(sf->cxt, _("\nThe partition table has been altered."));
> - fdisk_reread_partition_table(sf->cxt);
> + rc = fdisk_reread_partition_table(sf->cxt);
Yes, the old sfdisk implementation exit with error in this case, but
I'm not sure about it. The problem is that partition table is properly
written to the device (but kernel don't use it). If would be nice to
distinguish between this non-fatal error and another errors. Maybe we
need more return codes.
0 -- success
1 -- fatal error
2 -- minor error (e.g. reread problem)
.. or so. We can also add error codes for initial re-read check, etc.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sfdisk: exit with error if rereading partition table fails
2016-04-21 7:24 [PATCH] sfdisk: exit with error if rereading partition table fails Victor Dodon
2016-04-21 8:44 ` Karel Zak
@ 2016-05-05 9:45 ` Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2016-05-05 9:45 UTC (permalink / raw)
To: Victor Dodon; +Cc: util-linux
On Thu, Apr 21, 2016 at 12:24:58AM -0700, Victor Dodon wrote:
> disk-utils/sfdisk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, good enough for now. Thanks.
I'm going to improve [s]fdisk return codes later.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-05 9:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-21 7:24 [PATCH] sfdisk: exit with error if rereading partition table fails Victor Dodon
2016-04-21 8:44 ` Karel Zak
2016-05-05 9:45 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox