[asterisk-commits] murf: trunk r48767 - in /trunk: apps/ cdr/
channels/ include/ main/ res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 21 12:44:21 MST 2006
Author: murf
Date: Thu Dec 21 13:44:20 2006
New Revision: 48767
URL: http://svn.digium.com/view/asterisk?view=rev&rev=48767
Log:
a quick fix to app_sms.c to get rid of cursed compiler warnings so I can compile under --enable-dev-mode
Modified:
trunk/apps/app_chanspy.c
trunk/apps/app_dictate.c
trunk/apps/app_directory.c
trunk/apps/app_festival.c
trunk/apps/app_meetme.c
trunk/apps/app_mixmonitor.c
trunk/apps/app_record.c
trunk/apps/app_sms.c
trunk/apps/app_voicemail.c
trunk/cdr/cdr_sqlite.c
trunk/channels/chan_iax2.c
trunk/channels/chan_zap.c
trunk/include/asterisk.h
trunk/main/app.c
trunk/main/db.c
trunk/main/file.c
trunk/res/res_agi.c
trunk/res/res_convert.c
trunk/res/res_monitor.c
Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Thu Dec 21 13:44:20 2006
@@ -617,7 +617,7 @@
char filename[512];
snprintf(filename, sizeof(filename), "%s/%s.%d.raw", ast_config_AST_MONITOR_DIR, recbase, (int) time(NULL));
- if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644)) <= 0) {
+ if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, AST_FILE_MODE)) <= 0) {
ast_log(LOG_WARNING, "Cannot open '%s' for recording\n", filename);
fd = 0;
}
@@ -701,7 +701,7 @@
char filename[512];
snprintf(filename, sizeof(filename), "%s/%s.%d.raw", ast_config_AST_MONITOR_DIR, recbase, (int) time(NULL));
- if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0644)) <= 0) {
+ if ((fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, AST_FILE_MODE)) <= 0) {
ast_log(LOG_WARNING, "Cannot open '%s' for recording\n", filename);
fd = 0;
}
Modified: trunk/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dictate.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_dictate.c (original)
+++ trunk/apps/app_dictate.c Thu Dec 21 13:44:20 2006
@@ -150,7 +150,7 @@
}
snprintf(path, len, "%s/%s", base, filein);
- fs = ast_writefile(path, "raw", NULL, O_CREAT|O_APPEND, 0, 0700);
+ fs = ast_writefile(path, "raw", NULL, O_CREAT|O_APPEND, 0, AST_FILE_MODE);
mode = DMODE_PLAY;
memset(&flags, 0, sizeof(flags));
ast_set_flag(&flags, DFLAG_PAUSE);
@@ -307,7 +307,7 @@
} else {
oflags |= O_APPEND;
}
- fs = ast_writefile(path, "raw", NULL, oflags, 0, 0700);
+ fs = ast_writefile(path, "raw", NULL, oflags, 0, AST_FILE_MODE);
if (ast_test_flag(&flags, DFLAG_TRUNC)) {
ast_seekstream(fs, 0, SEEK_SET);
ast_clear_flag(&flags, DFLAG_TRUNC);
Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Thu Dec 21 13:44:20 2006
@@ -142,7 +142,7 @@
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
break;
}
- fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, 0770);
+ fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, AST_FILE_MODE);
if (fd < 0) {
ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
Modified: trunk/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_festival.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Thu Dec 21 13:44:20 2006
@@ -433,7 +433,7 @@
snprintf(cachefile, sizeof(cachefile), "%s/%s", cachedir, MD5Hex);
fdesc=open(cachefile,O_RDWR);
if (fdesc==-1) {
- fdesc=open(cachefile,O_CREAT|O_RDWR,0777);
+ fdesc=open(cachefile,O_CREAT|O_RDWR,AST_FILE_MODE);
if (fdesc!=-1) {
writecache=1;
strln=strlen((char *)data);
Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Thu Dec 21 13:44:20 2006
@@ -2874,7 +2874,7 @@
break;
}
if (!s && cnf->recordingfilename && (cnf->recordingfilename != oldrecordingfilename)) {
- s = ast_writefile(cnf->recordingfilename, cnf->recordingformat, NULL, flags, 0, 0644);
+ s = ast_writefile(cnf->recordingfilename, cnf->recordingformat, NULL, flags, 0, AST_FILE_MODE);
oldrecordingfilename = cnf->recordingfilename;
}
Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Thu Dec 21 13:44:20 2006
@@ -256,7 +256,7 @@
}
/* Move onto actually creating the filestream */
- mixmonitor->fs = ast_writefile(file_name, ext, NULL, oflags, 0, 0644);
+ mixmonitor->fs = ast_writefile(file_name, ext, NULL, oflags, 0, AST_FILE_MODE);
if (!mixmonitor->fs) {
ast_log(LOG_ERROR, "Cannot open %s.%s\n", file_name, ext);
free(mixmonitor);
Modified: trunk/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_record.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_record.c (original)
+++ trunk/apps/app_record.c Thu Dec 21 13:44:20 2006
@@ -265,7 +265,7 @@
flags = option_append ? O_CREAT|O_APPEND|O_WRONLY : O_CREAT|O_TRUNC|O_WRONLY;
- s = ast_writefile( tmp, ext, NULL, flags , 0, 0644);
+ s = ast_writefile( tmp, ext, NULL, flags , 0, AST_FILE_MODE);
if (!s) {
ast_log(LOG_WARNING, "Could not create file %s\n", filename);
Modified: trunk/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sms.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_sms.c (original)
+++ trunk/apps/app_sms.c Thu Dec 21 13:44:20 2006
@@ -245,7 +245,7 @@
int protocol; /*!< ETSI SMS protocol to use (passed at app call) */
int oseizure; /*!< protocol 2: channel seizure bits to send */
int framenumber; /*!< protocol 2: frame number (for sending ACK0 or ACK1) */
- unsigned char udtxt[SMSLEN]; /*!< user data (message), PLAIN text */
+ char udtxt[SMSLEN]; /*!< user data (message), PLAIN text */
} sms_t;
/* different types of encoding */
@@ -707,7 +707,7 @@
static void sms_log (sms_t * h, char status)
{
if (*h->oa || *h->da) {
- int o = open (log_file, O_CREAT | O_APPEND | O_WRONLY, 0666);
+ int o = open (log_file, O_CREAT | O_APPEND | O_WRONLY, AST_FILE_MODE);
if (o >= 0) {
char line[1000], mrs[3] = "", *p;
unsigned char n;
@@ -1184,14 +1184,14 @@
msgsz=20-1;
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "SMS-P2 Origin#%02X=[%.*s]\n",msg,msgsz,&h->imsg[f]);
- ast_copy_string (h->oa, &h->imsg[f], msgsz+1);
+ ast_copy_string (h->oa, (char*)(&h->imsg[f]), msgsz+1);
break;
case 0x18: /* Destination (from TE/phone) */
if (msgsz>=20)
msgsz=20-1;
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "SMS-P2 Destination#%02X=[%.*s]\n",msg,msgsz,&h->imsg[f]);
- ast_copy_string (h->da, &h->imsg[f], msgsz+1);
+ ast_copy_string (h->da, (char*)(&h->imsg[f]), msgsz+1);
break;
case 0x1C: /* Notify */
if (option_verbose > 2)
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Thu Dec 21 13:44:20 2006
@@ -1072,7 +1072,7 @@
ast_odbc_release_obj(obj);
goto yuck;
}
- fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, 0770);
+ fd = open(full_fn, O_RDWR | O_CREAT | O_TRUNC, VOICEMAIL_FILE_MODE);
if (fd < 0) {
ast_log(LOG_WARNING, "Failed to write '%s': %s\n", full_fn, strerror(errno));
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
Modified: trunk/cdr/cdr_sqlite.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_sqlite.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/cdr/cdr_sqlite.c (original)
+++ trunk/cdr/cdr_sqlite.c Thu Dec 21 13:44:20 2006
@@ -181,7 +181,7 @@
/* is the database there? */
snprintf(fn, sizeof(fn), "%s/cdr.db", ast_config_AST_LOG_DIR);
- db = sqlite_open(fn, 0660, &zErr);
+ db = sqlite_open(fn, AST_FILE_MODE, &zErr);
if (!db) {
ast_log(LOG_ERROR, "cdr_sqlite: %s\n", zErr);
free(zErr);
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Thu Dec 21 13:44:20 2006
@@ -1414,7 +1414,7 @@
ast_log(LOG_WARNING, "Cannot open '%s': %s\n", s, strerror(errno));
return -1;
}
- fd = open(s2, O_RDWR | O_CREAT | O_EXCL);
+ fd = open(s2, O_RDWR | O_CREAT | O_EXCL, AST_FILE_MODE);
if (fd < 0) {
ast_log(LOG_WARNING, "Cannot open '%s' for writing: %s\n", s2, strerror(errno));
close(ifd);
Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Thu Dec 21 13:44:20 2006
@@ -10242,7 +10242,7 @@
for (i = 0; i < NUM_DCHANS; i++) {
if (!pri->dchannels[i])
break;
- pri->fds[i] = open("/dev/zap/channel", O_RDWR, 0600);
+ pri->fds[i] = open("/dev/zap/channel", O_RDWR);
x = pri->dchannels[i];
if ((pri->fds[i] < 0) || (ioctl(pri->fds[i],ZT_SPECIFY,&x) == -1)) {
ast_log(LOG_ERROR, "Unable to open D-channel %d (%s)\n", x, strerror(errno));
@@ -10359,7 +10359,7 @@
if (ast_strlen_zero(argv[4]))
return RESULT_SHOWUSAGE;
- myfd = open(argv[4], O_CREAT|O_WRONLY);
+ myfd = open(argv[4], O_CREAT|O_WRONLY, AST_FILE_MODE);
if (myfd < 0) {
ast_cli(fd, "Unable to open '%s' for writing\n", argv[4]);
return RESULT_SUCCESS;
Modified: trunk/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk.h?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Thu Dec 21 13:44:20 2006
@@ -30,6 +30,16 @@
#include "asterisk/compat.h"
#include "asterisk/paths.h"
+
+/* Default to allowing the umask or filesystem ACLs to determine actual file
+ * creation permissions
+ */
+#ifndef AST_DIR_MODE
+#define AST_DIR_MODE 0777
+#endif
+#ifndef AST_FILE_MODE
+#define AST_FILE_MODE 0666
+#endif
#define DEFAULT_LANGUAGE "en"
Modified: trunk/main/app.c
URL: http://svn.digium.com/view/asterisk/trunk/main/app.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Thu Dec 21 13:44:20 2006
@@ -571,7 +571,7 @@
end = start = time(NULL); /* pre-initialize end to be same as start in case we never get into loop */
for (x = 0; x < fmtcnt; x++) {
- others[x] = ast_writefile(prepend ? prependfile : recordfile, sfmt[x], comment, O_TRUNC, 0, 0700);
+ others[x] = ast_writefile(prepend ? prependfile : recordfile, sfmt[x], comment, O_TRUNC, 0, AST_FILE_MODE);
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "x=%d, open writing: %s format: %s, %p\n", x, prepend ? prependfile : recordfile, sfmt[x], others[x]);
@@ -943,7 +943,7 @@
}
snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random());
- fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, AST_FILE_MODE);
if (fd < 0) {
ast_log(LOG_ERROR, "Unable to create lock file '%s': %s\n", path, strerror(errno));
return AST_LOCK_PATH_NOT_FOUND;
Modified: trunk/main/db.c
URL: http://svn.digium.com/view/asterisk/trunk/main/db.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/main/db.c (original)
+++ trunk/main/db.c Thu Dec 21 13:44:20 2006
@@ -62,7 +62,7 @@
static int dbinit(void)
{
- if (!astdb && !(astdb = dbopen((char *)ast_config_AST_DB, O_CREAT | O_RDWR, 0664, DB_BTREE, NULL))) {
+ if (!astdb && !(astdb = dbopen((char *)ast_config_AST_DB, O_CREAT | O_RDWR, AST_FILE_MODE, DB_BTREE, NULL))) {
ast_log(LOG_WARNING, "Unable to open Asterisk database\n");
return -1;
}
Modified: trunk/main/file.c
URL: http://svn.digium.com/view/asterisk/trunk/main/file.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/main/file.c (original)
+++ trunk/main/file.c Thu Dec 21 13:44:20 2006
@@ -214,7 +214,7 @@
ast_log(LOG_WARNING, "Unable to open %s in read-only mode\n", infile);
return -1;
}
- if ((ofd = open(outfile, O_WRONLY | O_TRUNC | O_CREAT, 0600)) < 0) {
+ if ((ofd = open(outfile, O_WRONLY | O_TRUNC | O_CREAT, AST_FILE_MODE)) < 0) {
ast_log(LOG_WARNING, "Unable to open %s in write-only mode\n", outfile);
close(ifd);
return -1;
Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Thu Dec 21 13:44:20 2006
@@ -961,7 +961,7 @@
if (res) {
fdprintf(agi->fd, "200 result=%d (randomerror) endpos=%ld\n", res, sample_offset);
} else {
- fs = ast_writefile(argv[2], argv[3], NULL, O_CREAT | O_WRONLY | (sample_offset ? O_APPEND : 0), 0, 0644);
+ fs = ast_writefile(argv[2], argv[3], NULL, O_CREAT | O_WRONLY | (sample_offset ? O_APPEND : 0), 0, AST_FILE_MODE);
if (!fs) {
res = -1;
fdprintf(agi->fd, "200 result=%d (writefile)\n", res);
Modified: trunk/res/res_convert.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_convert.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/res/res_convert.c (original)
+++ trunk/res/res_convert.c Thu Dec 21 13:44:20 2006
@@ -88,7 +88,7 @@
ast_cli(fd, "'%s' is an invalid filename!\n", argv[3]);
goto fail_out;
}
- if (!(fs_out = ast_writefile(name_out, ext_out, NULL, O_CREAT|O_TRUNC|O_WRONLY, 0, 0644))) {
+ if (!(fs_out = ast_writefile(name_out, ext_out, NULL, O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
ast_cli(fd, "Unable to open output file: %s\n", argv[3]);
goto fail_out;
}
Modified: trunk/res/res_monitor.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_monitor.c?view=diff&rev=48767&r1=48766&r2=48767
==============================================================================
--- trunk/res/res_monitor.c (original)
+++ trunk/res/res_monitor.c Thu Dec 21 13:44:20 2006
@@ -197,7 +197,7 @@
}
if (!(monitor->read_stream = ast_writefile(monitor->read_filename,
monitor->format, NULL,
- O_CREAT|O_TRUNC|O_WRONLY, 0, 0644))) {
+ O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
ast_log(LOG_WARNING, "Could not create file %s\n",
monitor->read_filename);
free(monitor);
@@ -209,7 +209,7 @@
}
if (!(monitor->write_stream = ast_writefile(monitor->write_filename,
monitor->format, NULL,
- O_CREAT|O_TRUNC|O_WRONLY, 0, 0644))) {
+ O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
ast_log(LOG_WARNING, "Could not create file %s\n",
monitor->write_filename);
ast_closestream(monitor->read_stream);
More information about the asterisk-commits
mailing list