<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><tt><big>Folks,<br>
<br>
&nbsp;&nbsp;&nbsp; There is a bug in app_voicemail.c that causes weird things to
happen with file permissions.&nbsp; I have submitted complete information,
as well as a patch, in bugs.digium.com, ID 0014912.&nbsp; This affects all
versions of Asterisk and has a very simple fix.<br>
<br>
See attached.<br>
<br>
Cheers,<br>
<br>
Jim<br>
</big><br>
<br>
</tt></font>The voicemail application has a bug where, depending on how
it is
compiled, it doesn't retain the umask value that is read upon module
load. This is the real source of the problem related to issues 0009231
and 0007504.<br>
<br>
The problem is that since my_umask is not declared static, compilers
are not required to persist its value. As such, some highly optimized
compilers will assign it a cpu register rather than variable space on
the stack. Since my_umask is only set during module load, subsequent
uses of my_umask are unreliable as the register will surely have been
overwritten prior to its next use.<br>
<br>
What made this difficult to diagnose was that the values seemed
reasonably close to real umask values, as the functions prior to its
use were related to the loading of the mask constant
VOICEMAIL_FILE_MODE 0666.<br>
<br>
The solution is simply to make my_umask static in app_voicemail.c<br>
<br>