[asterisk-commits] tzafrir: branch 1.6.2 r217519 - in /branches/1.6.2: ./ res/res_phoneprov.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 9 15:37:09 CDT 2009
Author: tzafrir
Date: Wed Sep 9 15:37:08 2009
New Revision: 217519
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=217519
Log:
gcc 4.4 fix: union instead of cast
gcc 4.4 has more strict rules for aliasing. It doesn't like a
struct sockaddr_in pointer pointing to a struct sockaddr. So we make it
a union.
Merged revisions 217445 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/res/res_phoneprov.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.2/res/res_phoneprov.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/res/res_phoneprov.c?view=diff&rev=217519&r1=217518&r2=217519
==============================================================================
--- branches/1.6.2/res/res_phoneprov.c (original)
+++ branches/1.6.2/res/res_phoneprov.c Wed Sep 9 15:37:08 2009
@@ -492,17 +492,20 @@
/* Unless we are overridden by serveriface or serveraddr, we set the SERVER variable to
* the IP address we are listening on that the phone contacted for this config file */
if (ast_strlen_zero(global_server)) {
- struct sockaddr name;
- socklen_t namelen = sizeof(name);
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in sa_in;
+ } name;
+ socklen_t namelen = sizeof(name.sa);
int res;
- if ((res = getsockname(ser->fd, &name, &namelen))) {
+ if ((res = getsockname(ser->fd, &name.sa, &namelen))) {
ast_log(LOG_WARNING, "Could not get server IP, breakage likely.\n");
} else {
struct ast_var_t *var;
struct extension *exten_iter;
- if ((var = ast_var_assign("SERVER", ast_inet_ntoa(((struct sockaddr_in *)&name)->sin_addr)))) {
+ if ((var = ast_var_assign("SERVER", ast_inet_ntoa(name.sa_in.sin_addr)))) {
AST_LIST_TRAVERSE(&route->user->extensions, exten_iter, entry) {
AST_LIST_INSERT_TAIL(exten_iter->headp, var, entries);
}
More information about the asterisk-commits
mailing list