Message ID | 20220208005621.4487-1-james.hilliard1@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/1] diskpart_handler: fix fdisk_assign_device return check | expand |
On 08.02.22 01:56, James Hilliard wrote: > We need to check and abort on all errors here as we can not > continue without a device assigned. > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > --- > handlers/diskpart_handler.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c > index d96d4e2..3b8aa6a 100644 > --- a/handlers/diskpart_handler.c > +++ b/handlers/diskpart_handler.c > @@ -186,8 +186,8 @@ static int diskpart_assign_context(struct fdisk_context **cxt,struct img_type *i > */ > ret = fdisk_assign_device(parent, path, 0); > free(path); > - if (ret == -EACCES) { > - ERROR("no access to %s", img->device); > + if (ret < 0) { > + ERROR("Device %s cannot be opened: %s", img->device, strerror(-ret)); > return ret; > } > Applied to -master, thanks ! Best regards, Stefano Babic
diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index d96d4e2..3b8aa6a 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -186,8 +186,8 @@ static int diskpart_assign_context(struct fdisk_context **cxt,struct img_type *i */ ret = fdisk_assign_device(parent, path, 0); free(path); - if (ret == -EACCES) { - ERROR("no access to %s", img->device); + if (ret < 0) { + ERROR("Device %s cannot be opened: %s", img->device, strerror(-ret)); return ret; }
We need to check and abort on all errors here as we can not continue without a device assigned. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> --- handlers/diskpart_handler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)