]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: dbox_cleanup_temp_files() - Remove unnecessary else/else if after returns
authorMarco Bettini <marco.bettini@open-xchange.com>
Tue, 28 Feb 2023 11:44:48 +0000 (11:44 +0000)
committermarkus.valentin <markus.valentin@open-xchange.com>
Fri, 10 Mar 2023 10:51:41 +0000 (10:51 +0000)
src/lib-storage/index/dbox-common/dbox-storage.c

index 8ff212bc62cf391b0f6f8ef9bab0e0864d089968..498c2cee75a24af1a378a521166dd419e21e4dae 100644 (file)
@@ -183,38 +183,39 @@ dbox_cleanup_temp_files(struct mailbox *box, const char *path,
        if (interval == 0) {
                /* disabled */
                return FALSE;
-       } else if (last_scan_time >= ioloop_time - (time_t)interval) {
+       }
+
+       if (last_scan_time >= ioloop_time - (time_t)interval) {
                /* not the time to scan it yet */
                return FALSE;
-       } else {
-               bool stated = FALSE;
-               if (last_change_time == (time_t)-1) {
-                       /* Don't know the ctime yet - look it up. */
-                       struct stat st;
-
-                       if (stat(path, &st) < 0) {
-                               if (errno != ENOENT)
-                                       e_error(box->event,
-                                               "stat(%s) failed: %m", path);
-                               return FALSE;
-                       }
-                       last_change_time = st.st_ctime;
-                       stated = TRUE;
-               }
-               if (last_scan_time > last_change_time + DBOX_TMP_DELETE_SECS) {
-                       /* there haven't been any changes to this directory
-                          since we last checked it. If we did an extra stat(),
-                          we need to update the last_scan_time to avoid
-                          stat()ing the next time. */
-                       return stated;
+       }
+
+       bool stated = FALSE;
+       if (last_change_time == (time_t)-1) {
+               /* Don't know the ctime yet - look it up. */
+               struct stat st;
+
+               if (stat(path, &st) < 0) {
+                       if (errno != ENOENT)
+                               e_error(box->event,
+                                       "stat(%s) failed: %m", path);
+                       return FALSE;
                }
-               const char *prefix =
-                       mailbox_list_get_global_temp_prefix(box->list);
-               (void)unlink_old_files(path, prefix,
-                                      ioloop_time - DBOX_TMP_DELETE_SECS);
-               return TRUE;
+               last_change_time = st.st_ctime;
+               stated = TRUE;
        }
-       return FALSE;
+       if (last_scan_time > last_change_time + DBOX_TMP_DELETE_SECS) {
+               /* there haven't been any changes to this directory
+                  since we last checked it. If we did an extra stat(),
+                  we need to update the last_scan_time to avoid
+                  stat()ing the next time. */
+               return stated;
+       }
+       const char *prefix =
+               mailbox_list_get_global_temp_prefix(box->list);
+       (void)unlink_old_files(path, prefix,
+                               ioloop_time - DBOX_TMP_DELETE_SECS);
+       return TRUE;
 }
 
 int dbox_mailbox_check_existence(struct mailbox *box)