Skip to content

Ensure error code is kept if destination dir is not writable#670

Open
ColemanTom wants to merge 1 commit intohpc:mainfrom
ColemanTom:dsync-write-to-nonexistant-dir-error-code-fix
Open

Ensure error code is kept if destination dir is not writable#670
ColemanTom wants to merge 1 commit intohpc:mainfrom
ColemanTom:dsync-write-to-nonexistant-dir-error-code-fix

Conversation

@ColemanTom
Copy link
Copy Markdown

This resolves #668. The error code was not being retained, so rc was stlil zero. I've added it in, keeping the errno value.

$ bin/dsync -X all -q m.grib2 zzfsdfzz/a; echo $?
2

Signed-off-by: ColemanTom <15375218+ColemanTom@users.noreply.github.com>
@ColemanTom
Copy link
Copy Markdown
Author

Hi @ofaaland, I was wondering if you are a maintainer and if so, have time to review this small change to ensure an error is returned from dsync when it should be (trying to write to a dir the user does not have access to).

Sorry for the nudge, I was just going through checking what PR I have open.

Comment thread src/dsync/dsync.c
Comment on lines +3364 to 3365
rc = errno;
goto ERROR;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rc=errno seems reasonable, but it seems the goto maybe should actually be goto dsync_common_cleanup since some things like mfu_copy_opts_delete(&copy_opts); need to be done. Though I'm not sure if everything in that cleanup section is needed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're probably correct. I'm happy to change that if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dsync to a folder that doesn't exist returns 0

2 participants