cast time_t to an int in printf/scanf (issue #5635)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@7634 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2005-12-26 18:19:12 +00:00
parent ef891dc0a7
commit a434f8877a
12 changed files with 44 additions and 42 deletions

View File

@@ -685,8 +685,10 @@ static int ast_makesocket(void)
ast_log(LOG_WARNING, "Unable to change ownership of %s: %s\n", ast_config_AST_SOCKET, strerror(errno));
if (!ast_strlen_zero(ast_config_AST_CTL_PERMISSIONS)) {
int p1;
mode_t p;
sscanf(ast_config_AST_CTL_PERMISSIONS, "%o", (int *) &p);
sscanf(ast_config_AST_CTL_PERMISSIONS, "%o", &p1);
p = p1;
if ((chmod(ast_config_AST_SOCKET, p)) < 0)
ast_log(LOG_WARNING, "Unable to change file permissions of %s: %s\n", ast_config_AST_SOCKET, strerror(errno));
}
@@ -1332,7 +1334,7 @@ static char *cli_prompt(EditLine *el)
if (*t == '%') {
char hostname[MAXHOSTNAMELEN]="";
int i;
struct timeval tv;
time_t ts;
struct tm tm;
#ifdef linux
FILE *LOADAVG;
@@ -1360,8 +1362,8 @@ static char *cli_prompt(EditLine *el)
break;
case 'd': /* date */
memset(&tm, 0, sizeof(struct tm));
tv = ast_tvnow();
if (localtime_r(&(tv.tv_sec), &tm)) {
time(&ts);
if (localtime_r(&ts, &tm)) {
strftime(p, sizeof(prompt) - strlen(prompt), "%Y-%m-%d", &tm);
}
break;
@@ -1417,8 +1419,8 @@ static char *cli_prompt(EditLine *el)
#endif
case 't': /* time */
memset(&tm, 0, sizeof(struct tm));
tv = ast_tvnow();
if (localtime_r(&(tv.tv_sec), &tm)) {
time(&ts);
if (localtime_r(&ts, &tm)) {
strftime(p, sizeof(prompt) - strlen(prompt), "%H:%M:%S", &tm);
}
break;