代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/util-linux 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 9e9ad25d690b284427f9a355475bcdddb17cf1e0 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 19 Aug 2021 12:10:02 +0200
Subject: [PATCH] sfdisk: write empty label also when only ignored partition
specified
sfdisk writes empty disk label only when "label:" header specified.
Unfortunately, this feature is ignored when all specified partitions
are ignored
echo -e "label: dos\n0,0,0\n" | sfdisk /dev/sdc
Fixes: https://github.com/karelzak/util-linux/issues/1413
Signed-off-by: Karel Zak <kzak@redhat.com>
---
disk-utils/sfdisk.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index 526d090..b08c945 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -1714,7 +1714,7 @@ static void refresh_prompt_buffer(struct sfdisk *sf, const char *devname,
*/
static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
{
- int rc = 0, partno = sf->partno, created = 0, unused = 0;
+ int rc = 0, partno = sf->partno, created = 0, unused = 0, ignored = 0;
struct fdisk_script *dp;
struct fdisk_table *tb = NULL;
const char *devname = NULL, *label;
@@ -1897,6 +1897,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
if (ignore_partition(pa)) {
fdisk_info(sf->cxt, _("Ignoring partition."));
next_partno++;
+ ignored++;
continue;
}
if (!created) { /* create a new disklabel */
@@ -1960,7 +1961,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
/* create empty disk label if label, but no partition specified */
if ((rc == SFDISK_DONE_EOF || rc == SFDISK_DONE_WRITE) && created == 0
&& fdisk_script_has_force_label(dp) == 1
- && fdisk_table_get_nents(tb) == 0
+ && fdisk_table_get_nents(tb) == (size_t) ignored
&& fdisk_script_get_header(dp, "label")) {
int xrc = fdisk_apply_script_headers(sf->cxt, dp);
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。