]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
printing: Simplify move_driver_to_download_area()
authorVolker Lendecke <vl@samba.org>
Sat, 3 Jan 2026 08:38:58 +0000 (09:38 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 20 Jan 2026 11:53:34 +0000 (11:53 +0000)
No need to call strlen() here. Just came across this while looking at
SMB_VFS_CREATE_FILE callers...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/printing/nt_printing.c

index 81f5f53962b11f8489c25489c44e4590b1611e19..7683e312f2e8988aacd97a8a9aa5fa548db6530d 100644 (file)
@@ -1593,8 +1593,8 @@ WERROR move_driver_to_download_area(const struct auth_session_info *session_info
 
        DEBUG(5,("Moving files now !\n"));
 
-       if (driver->driver_path && strlen(driver->driver_path)) {
-
+       if ((driver->driver_path != NULL) && (driver->driver_path[0] != '\0'))
+       {
                err = move_driver_file_to_download_area(frame,
                                                        conn,
                                                        driver->driver_path,
@@ -1607,7 +1607,7 @@ WERROR move_driver_to_download_area(const struct auth_session_info *session_info
                }
        }
 
-       if (driver->data_file && strlen(driver->data_file)) {
+       if ((driver->data_file != NULL) && (driver->data_file[0] != '\0')) {
                if (!strequal(driver->data_file, driver->driver_path)) {
 
                        err = move_driver_file_to_download_area(frame,
@@ -1623,7 +1623,8 @@ WERROR move_driver_to_download_area(const struct auth_session_info *session_info
                }
        }
 
-       if (driver->config_file && strlen(driver->config_file)) {
+       if ((driver->config_file != NULL) && (driver->config_file[0] != '\0'))
+       {
                if (!strequal(driver->config_file, driver->driver_path) &&
                    !strequal(driver->config_file, driver->data_file)) {
 
@@ -1640,7 +1641,7 @@ WERROR move_driver_to_download_area(const struct auth_session_info *session_info
                }
        }
 
-       if (driver->help_file && strlen(driver->help_file)) {
+       if ((driver->help_file != NULL) && (driver->help_file[0] != '\0')) {
                if (!strequal(driver->help_file, driver->driver_path) &&
                    !strequal(driver->help_file, driver->data_file) &&
                    !strequal(driver->help_file, driver->config_file)) {