libfdisk: reset context FD on error
When the query disk fails, reset cxt->dev_fd. Addresses: https://github.com/karelzak/util-linux/pull/1137 Addresses: https://github.com/karelzak/util-linux/issues/1131 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
f29a2cfbe1
commit
933f095feb
|
@ -636,6 +636,7 @@ static int fdisk_assign_fd(struct fdisk_context *cxt, int fd,
|
|||
fail:
|
||||
{
|
||||
int rc = -errno;
|
||||
cxt->dev_fd = -1;
|
||||
DBG(CXT, ul_debugobj(cxt, "failed to assign device [rc=%d]", rc));
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue