[Asterisk-code-review] Revert "app_voicemail: Cleanup stale lock files on module load" (...asterisk[13])

Sean Bright asteriskteam at digium.com
Mon Oct 7 14:02:43 CDT 2019


Hello Benjamin Keith Ford, Friendly Automation, George Joseph, Joshua Colp,

I'd like you to do a code review. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/13017

to review the following change.


Change subject: Revert "app_voicemail: Cleanup stale lock files on module load"
......................................................................

Revert "app_voicemail: Cleanup stale lock files on module load"

This reverts commit fd2e8d0da7ba539470ed73d463d8bc641f7843af.

Reason for revert: Problematic for users who store their voicemail
on network storage devices, or share voicemail storage between
multiple Asterisk instances.

Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41
---
M apps/app_voicemail.c
1 file changed, 0 insertions(+), 51 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/17/13017/1

diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 079aaac..64167d1 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3795,54 +3795,6 @@
 
 #endif /* IMAP_STORAGE */
 
-static void cleanup_orphaned_lock_files(const char *base)
-{
-	DIR *dir;
-	struct dirent *e;
-
-	dir = opendir(base);
-	if (!dir) {
-		/* Don't complain about this too loudly */
-		ast_debug(2, "Unable to open `%s': %s\n", base, strerror(errno));
-		return;
-	}
-
-	while ((e = readdir(dir))) {
-		char *fullpath;
-		struct stat s;
-
-		/* Always skip . and .. */
-		if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, "..")) {
-			continue;
-		}
-
-		/* Build up the full path (using dynamic memory because PATH_MAX is crap) */
-		if (ast_asprintf(&fullpath, "%s/%s", base, e->d_name) == -1) {
-			break;
-		}
-
-		if (lstat(fullpath, &s) < 0) {
-			ast_free(fullpath);
-			continue;
-		}
-
-		/* This is exposing an implementation detail of ast_lock_path, but it makes
-		 * our life a bit easier */
-		if (!strcmp(e->d_name, ".lock") && S_ISLNK(s.st_mode)) {
-			if (!ast_unlock_path(base)) {
-				ast_log(AST_LOG_NOTICE, "Cleaned up orphaned lock file: %s/.lock\n", base);
-			}
-		} else if (S_ISDIR(s.st_mode)) {
-			/* If it is a directory, let's dive down */
-			cleanup_orphaned_lock_files(fullpath);
-		}
-
-		ast_free(fullpath);
-	}
-
-	closedir(dir);
-}
-
 /*! \brief Lock file path
  * only return failure if ast_lock_path returns 'timeout',
  * not if the path does not exist or any other reason
@@ -15354,9 +15306,6 @@
 	/* compute the location of the voicemail spool directory */
 	snprintf(VM_SPOOL_DIR, sizeof(VM_SPOOL_DIR), "%s/voicemail/", ast_config_AST_SPOOL_DIR);
 
-	/* Now that we have a spool directory, clean up old lock files */
-	cleanup_orphaned_lock_files(VM_SPOOL_DIR);
-
 	if (!(mwi_subscription_tps = ast_taskprocessor_get("app_voicemail", 0))) {
 		ast_log(AST_LOG_WARNING, "failed to reference mwi subscription taskprocessor.  MWI will not work\n");
 	}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13017
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I3ff4ca983d8e753fe2971f3439bd154705693c41
Gerrit-Change-Number: 13017
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191007/d1c1a5a1/attachment.html>


More information about the asterisk-code-review mailing list