"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: Loss of original errors
To:
gameoftrees@openbsd.org
Date:
Wed, 12 Jul 2023 21:21:18 +0200

Download raw body.

Thread
Stefan Sperling:

>  	err = got_path_mkdir(abspath);
> -	if (err && err->code == GOT_ERR_ERRNO && errno == EEXIST) {
> -		struct stat sb;
> -		err = NULL;
> -		if (lstat(abspath, &sb) == -1) {
> -			err = got_error_from_errno2("lstat", abspath);
> -		} else if (!S_ISDIR(sb.st_mode)) {
> -			/* TODO directory is obstructed; do something */
> -			err = got_error_path(abspath, GOT_ERR_FILE_OBSTRUCTED);
> -		}
> +	if (err)
> +		goto done;
> +
> +	if (lstat(abspath, &sb) == -1) {
> +		err = got_error_from_errno2("lstat", abspath);
> +	} else if (!S_ISDIR(sb.st_mode)) {
> +		/* TODO directory is obstructed; do something */
> +		err = got_error_path(abspath, GOT_ERR_FILE_OBSTRUCTED);
>  	}

That doesn't look right.  If we successfully create a new directory,
we'll return an error that the path was obstructed.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de