From: Volker Lendecke Date: Sun, 4 Jan 2026 10:31:17 +0000 (+0100) Subject: printing: Simplify file_version_is_newer() X-Git-Tag: tdb-1.4.15~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae45e424ca4e26fa2f78be7e12716b4223c2ab40;p=thirdparty%2Fsamba.git printing: Simplify file_version_is_newer() We don't need to call fstat(), driver_unix_convert() already does it via filename_convert_dirfsp(). Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 89f31a60406..9f7c3e6ac7f 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -823,6 +823,8 @@ static int file_version_is_newer(connection_struct *conn, goto error_exit; } + old_stat = smb_fname->st; + status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ @@ -860,16 +862,12 @@ static int file_version_is_newer(connection_struct *conn, if (!ret) { struct timeval_buf buf; - DBG_NOTICE("Version info not found [%s], use mod time\n", - old_file); - use_version = false; - if (SMB_VFS_FSTAT(fsp, &old_stat) == -1) { - goto error_exit; - } - DBG_NOTICE("mod time = %s\n", + DBG_NOTICE("Version info not found [%s], use mod time = %s\n", + old_file, timespec_string_buf(&old_stat.st_ex_mtime, true, &buf)); + use_version = false; } close_file_free(NULL, &fsp, NORMAL_CLOSE); @@ -880,6 +878,8 @@ static int file_version_is_newer(connection_struct *conn, goto error_exit; } + new_stat = smb_fname->st; + status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ @@ -916,16 +916,12 @@ static int file_version_is_newer(connection_struct *conn, if (!ret) { struct timeval_buf buf; - DBG_INFO("Version info not found [%s], use mod time\n", - new_file); + DBG_INFO("Version info not found [%s], use mod time = %s\n", + new_file, + timespec_string_buf(&new_stat.st_ex_mtime, + true, + &buf)); use_version = false; - if (SMB_VFS_FSTAT(fsp, &new_stat) == -1) { - goto error_exit; - } - DBG_NOTICE("mod time = %s\n", - timespec_string_buf(&new_stat.st_ex_mtime, - true, - &buf)); } close_file_free(NULL, &fsp, NORMAL_CLOSE);