<p>Sean Bright would like Benjamin Keith Ford, Friendly Automation, George Joseph and Joshua Colp to <strong>review</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13017">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Revert "app_voicemail: Cleanup stale lock files on module load"<br><br>This reverts commit fd2e8d0da7ba539470ed73d463d8bc641f7843af.<br><br>Reason for revert: Problematic for users who store their voicemail<br>on network storage devices, or share voicemail storage between<br>multiple Asterisk instances.<br><br>Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41<br>---<br>M apps/app_voicemail.c<br>1 file changed, 0 insertions(+), 51 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/17/13017/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index 079aaac..64167d1 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -3795,54 +3795,6 @@</span><br><span> </span><br><span> #endif /* IMAP_STORAGE */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static void cleanup_orphaned_lock_files(const char *base)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-        DIR *dir;</span><br><span style="color: hsl(0, 100%, 40%);">-       struct dirent *e;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       dir = opendir(base);</span><br><span style="color: hsl(0, 100%, 40%);">-    if (!dir) {</span><br><span style="color: hsl(0, 100%, 40%);">-             /* Don't complain about this too loudly */</span><br><span style="color: hsl(0, 100%, 40%);">-          ast_debug(2, "Unable to open `%s': %s\n", base, strerror(errno));</span><br><span style="color: hsl(0, 100%, 40%);">-         return;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       while ((e = readdir(dir))) {</span><br><span style="color: hsl(0, 100%, 40%);">-            char *fullpath;</span><br><span style="color: hsl(0, 100%, 40%);">-         struct stat s;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-          /* Always skip . and .. */</span><br><span style="color: hsl(0, 100%, 40%);">-              if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, "..")) {</span><br><span style="color: hsl(0, 100%, 40%);">-                    continue;</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               /* Build up the full path (using dynamic memory because PATH_MAX is crap) */</span><br><span style="color: hsl(0, 100%, 40%);">-            if (ast_asprintf(&fullpath, "%s/%s", base, e->d_name) == -1) {</span><br><span style="color: hsl(0, 100%, 40%);">-                 break;</span><br><span style="color: hsl(0, 100%, 40%);">-          }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               if (lstat(fullpath, &s) < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-                   ast_free(fullpath);</span><br><span style="color: hsl(0, 100%, 40%);">-                     continue;</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               /* This is exposing an implementation detail of ast_lock_path, but it makes</span><br><span style="color: hsl(0, 100%, 40%);">-              * our life a bit easier */</span><br><span style="color: hsl(0, 100%, 40%);">-             if (!strcmp(e->d_name, ".lock") && S_ISLNK(s.st_mode)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                   if (!ast_unlock_path(base)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                           ast_log(AST_LOG_NOTICE, "Cleaned up orphaned lock file: %s/.lock\n", base);</span><br><span style="color: hsl(0, 100%, 40%);">-                   }</span><br><span style="color: hsl(0, 100%, 40%);">-               } else if (S_ISDIR(s.st_mode)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                        /* If it is a directory, let's dive down */</span><br><span style="color: hsl(0, 100%, 40%);">-                 cleanup_orphaned_lock_files(fullpath);</span><br><span style="color: hsl(0, 100%, 40%);">-          }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               ast_free(fullpath);</span><br><span style="color: hsl(0, 100%, 40%);">-     }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       closedir(dir);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*! \brief Lock file path</span><br><span>  * only return failure if ast_lock_path returns 'timeout',</span><br><span>  * not if the path does not exist or any other reason</span><br><span>@@ -15354,9 +15306,6 @@</span><br><span>        /* compute the location of the voicemail spool directory */</span><br><span>  snprintf(VM_SPOOL_DIR, sizeof(VM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* Now that we have a spool directory, clean up old lock files */</span><br><span style="color: hsl(0, 100%, 40%);">-       cleanup_orphaned_lock_files(VM_SPOOL_DIR);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>   if (!(mwi_subscription_tps = ast_taskprocessor_get("app_voicemail", 0))) {</span><br><span>                 ast_log(AST_LOG_WARNING, "failed to reference mwi subscription taskprocessor.  MWI will not work\n");</span><br><span>      }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13017">change 13017</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/13017"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41 </div>
<div style="display:none"> Gerrit-Change-Number: 13017 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>