Message ID | 20210826072500.47187-1-james.hilliard1@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2,1/1] diskpart: fix computed partname when device is a symlink | expand |
Hi James, On 26.08.21 09:25, James Hilliard wrote: > Fixes: > ERROR : Device /dev/internal1 cannot be opened: No such file or directory > ERROR : creating vfat file system on /dev/internal1 failed. -1 > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > --- > Changes v1 -> v2: > - fix realpath fallback path assignment > --- > handlers/diskpart_handler.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c > index 3e3da15..45ee97c 100644 > --- a/handlers/diskpart_handler.c > +++ b/handlers/diskpart_handler.c > @@ -954,9 +954,14 @@ handler_release: > if (!strlen(part->fstype)) > continue; /* Don't touch partitions without fstype */ > > + char *path = NULL; > char *device = NULL; > > - device = fdisk_partname(img->device, partno); > + path = realpath(img->device, NULL); > + if (!path) > + path = strdup(img->device); > + device = fdisk_partname(path, partno); > + free(path); > ret = diskformat_mkfs(device, part->fstype); > free(device); > if (ret) > Yep, correct ! Acked-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic
On 26.08.21 09:25, James Hilliard wrote: > Fixes: > ERROR : Device /dev/internal1 cannot be opened: No such file or directory > ERROR : creating vfat file system on /dev/internal1 failed. -1 > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > --- > Changes v1 -> v2: > - fix realpath fallback path assignment > --- > handlers/diskpart_handler.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c > index 3e3da15..45ee97c 100644 > --- a/handlers/diskpart_handler.c > +++ b/handlers/diskpart_handler.c > @@ -954,9 +954,14 @@ handler_release: > if (!strlen(part->fstype)) > continue; /* Don't touch partitions without fstype */ > > + char *path = NULL; > char *device = NULL; > > - device = fdisk_partname(img->device, partno); > + path = realpath(img->device, NULL); > + if (!path) > + path = strdup(img->device); > + device = fdisk_partname(path, partno); > + free(path); > ret = diskformat_mkfs(device, part->fstype); > free(device); > if (ret) > Applied to -master, thanks ! Best regards, Stefano Babic
diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index 3e3da15..45ee97c 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -954,9 +954,14 @@ handler_release: if (!strlen(part->fstype)) continue; /* Don't touch partitions without fstype */ + char *path = NULL; char *device = NULL; - device = fdisk_partname(img->device, partno); + path = realpath(img->device, NULL); + if (!path) + path = strdup(img->device); + device = fdisk_partname(path, partno); + free(path); ret = diskformat_mkfs(device, part->fstype); free(device); if (ret)
Fixes: ERROR : Device /dev/internal1 cannot be opened: No such file or directory ERROR : creating vfat file system on /dev/internal1 failed. -1 Signed-off-by: James Hilliard <james.hilliard1@gmail.com> --- Changes v1 -> v2: - fix realpath fallback path assignment --- handlers/diskpart_handler.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)