Eric Biggers wrote:
> It was possible for ntfs_attr_name_get() to set errno due to a wide
> character string that could not be converted to a multibyte string. This
> caused ntfs_delete() to fail.
>
> Fix by checking for a nonzero return value specifically from
> ntfs_attr_lookup(), rather than assuming that nothing else sets errno.
>
> Signed-off-by: Eric Biggers <[email protected]>
Sounds good, thanks.
Pushed now.
FYI Following a recent patch, translations of wide chars
to utf-8 should never fail any more, even when they are
invalid Unicode ones.
Jean-Pierre
> ---
> libntfs-3g/dir.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c
> index ce69eaf..bd049d2 100644
> --- a/libntfs-3g/dir.c
> +++ b/libntfs-3g/dir.c
> @@ -1904,12 +1904,11 @@ int ntfs_delete(ntfs_volume *vol, const char
> *pathname,
> if (!actx)
> goto err_out;
> search:
> - while (!ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, CASE_SENSITIVE,
> - 0, NULL, 0, actx)) {
> + while (!(err = ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0,
> + CASE_SENSITIVE, 0, NULL, 0, actx))) {
> char *s;
> IGNORE_CASE_BOOL case_sensitive = IGNORE_CASE;
>
> - errno = 0;
> fn = (FILE_NAME_ATTR*)((u8*)actx->attr +
> le16_to_cpu(actx->attr->value_offset));
> s = ntfs_attr_name_get(fn->file_name, fn->file_name_length);
> @@ -1958,7 +1957,7 @@ search:
> break;
> }
> }
> - if (errno) {
> + if (err) {
> /*
> * If case sensitive search failed, then try once again
> * ignoring case.
>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel