[asterisk-commits] trunk r37514 - in /trunk: ./ app.c
apps/app_voicemail.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Jul 13 08:20:02 MST 2006
Author: kpfleming
Date: Thu Jul 13 10:20:02 2006
New Revision: 37514
URL: http://svn.digium.com/view/asterisk?rev=37514&view=rev
Log:
Merged revisions 37441-37442 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r37441 | kpfleming | 2006-07-12 10:46:56 -0500 (Wed, 12 Jul 2006) | 3 lines
fix a case where ast_lock_path() could leave a randomly-named lock file hanging around
make ast_unlock_path actually report when unlocking fails
........
r37442 | kpfleming | 2006-07-12 10:53:53 -0500 (Wed, 12 Jul 2006) | 2 lines
fix a weird case where a lock file could be left (but would happen almost never)
........
Modified:
trunk/ (props changed)
trunk/app.c
trunk/apps/app_voicemail.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=37514&r1=37513&r2=37514&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Thu Jul 13 10:20:02 2006
@@ -931,11 +931,13 @@
start = time(NULL);
while (((res = link(fs, s)) < 0) && (errno == EEXIST) && (time(NULL) - start < 5))
usleep(1);
+
+ unlink(fs);
+
if (res) {
ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n", path, strerror(errno));
return AST_LOCK_TIMEOUT;
} else {
- unlink(fs);
ast_log(LOG_DEBUG, "Locked path '%s'\n", path);
return AST_LOCK_SUCCESS;
}
@@ -944,11 +946,21 @@
int ast_unlock_path(const char *path)
{
char *s;
- if (!(s = alloca(strlen(path) + 10)))
+ int res;
+
+ if (!(s = alloca(strlen(path) + 10))) {
+ ast_log(LOG_WARNING, "Out of memory!\n");
return -1;
+ }
+
snprintf(s, strlen(path) + 9, "%s/%s", path, ".lock");
- ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
- return unlink(s);
+
+ if ((res = unlink(s)))
+ ast_log(LOG_ERROR, "Could not unlock path '%s': %s\n", path, strerror(errno));
+ else
+ ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
+
+ return res;
}
int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path)
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=37514&r1=37513&r2=37514&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Thu Jul 13 10:20:02 2006
@@ -2650,7 +2650,8 @@
} else if (ast_fileexists(tmptxtfile, NULL, NULL) <= 0) {
if (option_debug)
ast_log(LOG_DEBUG, "The recorded media file is gone, so we should remove the .txt file too!\n");
- unlink(tmptxtfile);
+ unlink(tmptxtfile);
+ ast_unlock_path(dir);
} else {
for (;;) {
make_file(fn, sizeof(fn), dir, msgnum);
More information about the asterisk-commits
mailing list