checking functions return values

while following symlinks on open, after we break from the loop we need to respect that nfs41_lookup could have returned some kind of error value. thus only return error_reparse if nfs41_lookup returned success or file_not_found error.

similarly in after calling nfs41_symlink_follow() only set the reparse_error if function was successful.
This commit is contained in:
Olga Kornievskaia 2010-10-19 12:14:40 -04:00
parent bacbf060e3
commit a7e2d6ad2a

View file

@ -259,10 +259,12 @@ int handle_open(nfs41_upcall *upcall)
&state->path, &state->parent, NULL, NULL, &state->session); &state->path, &state->parent, NULL, NULL, &state->session);
} while (status == ERROR_REPARSE); } while (status == ERROR_REPARSE);
abs_path_copy(&args->symlink, &state->path); if (status == NO_ERROR || status == ERROR_FILE_NOT_FOUND) {
status = NO_ERROR; abs_path_copy(&args->symlink, &state->path);
upcall->last_error = ERROR_REPARSE; status = NO_ERROR;
args->symlink_embedded = TRUE; upcall->last_error = ERROR_REPARSE;
args->symlink_embedded = TRUE;
}
goto out_free_state; goto out_free_state;
} }
@ -297,13 +299,17 @@ int handle_open(nfs41_upcall *upcall)
if (target_status == NO_ERROR && target_info.type == NF4DIR) if (target_status == NO_ERROR && target_info.type == NF4DIR)
info.symlink_dir = TRUE; info.symlink_dir = TRUE;
} else { } else {
/* tell the driver to call RxPrepareToReparseSymbolicLink() */
upcall->last_error = ERROR_REPARSE;
args->symlink_embedded = FALSE;
/* replace the path with the symlink target */ /* replace the path with the symlink target */
status = nfs41_symlink_target(state->session, status = nfs41_symlink_target(state->session,
&state->file, &args->symlink); &state->file, &args->symlink);
if (status) {
eprintf("nfs41_symlink_target() for %s failed with %d\n",
args->path, status);
} else {
/* tell the driver to call RxPrepareToReparseSymbolicLink() */
upcall->last_error = ERROR_REPARSE;
args->symlink_embedded = FALSE;
}
goto out_free_state; goto out_free_state;
} }
} else } else