]> 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>
Tue, 25 Apr 2023 07:52:50 +0000 (09:52 +0200)
src/lib-storage/index/dbox-common/dbox-storage.c

index b987aa0b834033f58eebefd1f45fe6f55b293721..886fe09d711496670fd1250a81753b74e33c3237 100644 (file)
@@ -181,37 +181,38 @@ dbox_cleanup_temp_files(struct mailbox_list *list, 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)
-                                       i_error("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)
+                               i_error("stat(%s) failed: %m", path);
+                       return FALSE;
                }
-               const char *prefix =
-                       mailbox_list_get_global_temp_prefix(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(list);
+       (void)unlink_old_files(path, prefix,
+                               ioloop_time - DBOX_TMP_DELETE_SECS);
+       return TRUE;
 }
 
 int dbox_mailbox_check_existence(struct mailbox *box)