From: Volker Lendecke Date: Mon, 26 Jun 2023 10:48:16 +0000 (+0200) Subject: error_inject: Reduce indentation with an early return X-Git-Tag: talloc-2.4.1~113 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f6a24e7d29e4e71575331c9e4d2862c1d2a274da;p=thirdparty%2Fsamba.git error_inject: Reduce indentation with an early return Review with "git show -b" Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_error_inject.c b/source3/modules/vfs_error_inject.c index edb7c64a92a..529504fd8d5 100644 --- a/source3/modules/vfs_error_inject.c +++ b/source3/modules/vfs_error_inject.c @@ -52,29 +52,29 @@ static int find_unix_error_from_string(const char *err_str) static int inject_unix_error(const char *vfs_func, vfs_handle_struct *handle) { const char *err_str; + int error; err_str = lp_parm_const_string(SNUM(handle->conn), "error_inject", vfs_func, NULL); + if (err_str == NULL) { + return 0; + } - if (err_str != NULL) { - int error; - - error = find_unix_error_from_string(err_str); - if (error != 0) { - DBG_WARNING("Returning error %s for VFS function %s\n", - err_str, vfs_func); - return error; - } - - if (strequal(err_str, "panic")) { - DBG_ERR("Panic in VFS function %s\n", vfs_func); - smb_panic("error_inject"); - } + error = find_unix_error_from_string(err_str); + if (error != 0) { + DBG_WARNING("Returning error %s for VFS function %s\n", + err_str, vfs_func); + return error; + } - DBG_ERR("Unknown error inject %s requested " - "for vfs function %s\n", err_str, vfs_func); + if (strequal(err_str, "panic")) { + DBG_ERR("Panic in VFS function %s\n", vfs_func); + smb_panic("error_inject"); } + DBG_ERR("Unknown error inject %s requested " + "for vfs function %s\n", err_str, vfs_func); + return 0; }