[Lsb-messages] /var/www/bzr/lsb/devel/olver-core-tests r91: Bug 3384, misprints and warnings

Roman at mail.linuxfoundation.org Roman at mail.linuxfoundation.org
Sun Sep 9 19:27:20 UTC 2012


------------------------------------------------------------
revno: 91
committer: Roman Zybin
branch nick: olver-core-tests
timestamp: Sun 2012-09-09 23:27:20 +0400
message:
  Bug 3384, misprints and warnings
modified:
  src/agent/common/agent.c
  src/agent/fs/fifo/fifo_agent.c
  src/agent/fs/symlink/symlink_agent.c
  src/agent/io/pipe/pipe_agent.c
  src/agent/process/ipc/ipc_agent.c
  src/agent/process/scheduler/scheduler_agent.c
  src/agent/util/search/hash_agent.c
-------------- next part --------------
=== modified file 'src/agent/common/agent.c'
--- a/src/agent/common/agent.c	2012-08-23 18:34:33 +0000
+++ b/src/agent/common/agent.c	2012-09-09 19:27:20 +0000
@@ -593,18 +593,24 @@
 
 void ta_gethostaddress(struct sockaddr_in* addr,const char* host,int port)
 {
-    struct hostent* hp;
-
-    // Family
-    addr->sin_family = AF_INET;
-    // Host
-    hp = gethostbyname(host);
-    if (hp == NULL)
-    {
-        assertion(0,"Can not find host by name [%s]",host);
+    int s;
+    struct addrinfo hints;
+    struct addrinfo *result;
+
+    // Family and Host
+    memset(&hints, 0, sizeof(struct addrinfo));
+    hints.ai_family = AF_INET;      /* Allow IPv4 */
+    hints.ai_socktype = SOCK_STREAM;
+    hints.ai_flags = 0;
+    hints.ai_protocol = IPPROTO_TCP;
+
+    if ( (s = getaddrinfo(host, NULL /* specify a port as a char* */, &hints, &result)) != 0 ){
+        assertion(0,"Can not find host by name [%s], %s",host,gai_strerror(s));
         return;
     }
-    memcpy((char*)&addr->sin_addr,(char*)hp->h_addr,hp->h_length);
+    memcpy((char*)addr,(char*)result->ai_addr,result->ai_addrlen);
+    freeaddrinfo(result);
+    
     // Port
     addr->sin_port = htons(port);
 }
@@ -717,11 +723,11 @@
 
     pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,&cancelstate);
 
-//    for (i=0;i<length;i++)
-//    {
-//        ta_debug_printf("%c", buffer[i]);
- //   }
- //   ta_debug_printf("\n");
+    //for (i=0;i<length;i++)
+    //{
+    //    ta_debug_printf("%c", buffer[i]);
+    //}
+    //ta_debug_printf("\n");
 
     if (send(COMMUNICATOR_DATA(thread).sockid,(char*)buffer,length,0) != length)
         assertion(0,"Send of message failed");

=== modified file 'src/agent/fs/fifo/fifo_agent.c'
--- a/src/agent/fs/fifo/fifo_agent.c	2008-09-05 17:30:58 +0000
+++ b/src/agent/fs/fifo/fifo_agent.c	2012-09-09 19:27:20 +0000
@@ -43,7 +43,7 @@
     // Prepare
     path = readString(&stream);
     mode = readFilePermissions(&stream);
-
+    errno = 0;
 
     START_TARGET_OPERATION(thread);
 
@@ -77,6 +77,7 @@
 
     writeString(thread,"Ok");
     sendResponse(thread);
+    errno = 0;
 
 
     START_TARGET_OPERATION(thread);
@@ -113,6 +114,7 @@
 
     writeString(thread,"Ok");
     sendResponse(thread);
+    errno = 0;
 
 
     START_TARGET_OPERATION(thread);
@@ -160,6 +162,7 @@
 
     writeString(thread,"Ok");
     sendResponse(thread);
+    errno = 0;
 
 
     START_TARGET_OPERATION(thread);
@@ -209,6 +212,7 @@
 
     writeString(thread,"Ok");
     sendResponse(thread);
+    errno = 0;
 
 
     START_TARGET_OPERATION(thread);
@@ -254,6 +258,7 @@
 
     writeString(thread,"Ok");
     sendResponse(thread);
+    errno = 0;
 
 
     START_TARGET_OPERATION(thread);
@@ -307,6 +312,7 @@
 
     writeString(thread,"Ok");
     sendResponse(thread);
+    errno = 0;
 
     START_TARGET_OPERATION(thread);
 

=== modified file 'src/agent/fs/symlink/symlink_agent.c'
--- a/src/agent/fs/symlink/symlink_agent.c	2008-09-05 17:30:58 +0000
+++ b/src/agent/fs/symlink/symlink_agent.c	2012-09-09 19:27:20 +0000
@@ -41,6 +41,7 @@
 
   assertion( buf != NULL || oldBuf!=NULL, "readlink_cmd: not enough memory" );
   memcpy(oldBuf, buf, bufsize);
+  errno = 0;
 
   START_TARGET_OPERATION(thread);
   res=readlink(path, buf, bufsize);
@@ -63,7 +64,7 @@
 
   path1=readString(&stream);
   path2=readString(&stream);
-
+  errno = 0;
 
   START_TARGET_OPERATION_WHICH_MAY_CONTAIN_CANCELPOINT(thread);
   res=symlink(path1, path2);

=== modified file 'src/agent/io/pipe/pipe_agent.c'
--- a/src/agent/io/pipe/pipe_agent.c	2008-09-05 17:30:58 +0000
+++ b/src/agent/io/pipe/pipe_agent.c	2012-09-09 19:27:20 +0000
@@ -36,6 +36,7 @@
 {
     int fildes[2];
     int res;
+    errno = 0;
 
     START_TARGET_OPERATION(thread);
 

=== modified file 'src/agent/process/ipc/ipc_agent.c'
--- a/src/agent/process/ipc/ipc_agent.c	2008-09-05 17:30:58 +0000
+++ b/src/agent/process/ipc/ipc_agent.c	2012-09-09 19:27:20 +0000
@@ -35,7 +35,8 @@
 
     // Prepare
     path = readString(&stream);
-    id= readInt(&stream);
+    id = readInt(&stream);
+    errno = 0;
     
     START_TARGET_OPERATION(thread);
     res = ftok(path, id); 

=== modified file 'src/agent/process/scheduler/scheduler_agent.c'
--- a/src/agent/process/scheduler/scheduler_agent.c	2012-02-11 00:16:55 +0000
+++ b/src/agent/process/scheduler/scheduler_agent.c	2012-09-09 19:27:20 +0000
@@ -83,7 +83,8 @@
 
     // Prepare
     policy = readInt(&stream);
-     
+    errno = 0;
+
     START_TARGET_OPERATION(thread);
     res = sched_get_priority_max(policy);
     END_TARGET_OPERATION(thread);
@@ -103,7 +104,8 @@
         
     // Prepare
     policy = readInt(&stream);
-    
+    errno = 0;    
+
     START_TARGET_OPERATION(thread);
     res = sched_get_priority_min(policy);
     END_TARGET_OPERATION(thread);
@@ -124,7 +126,8 @@
     
     // Prepare
     pid = readInt(&stream);
-    
+    errno = 0;
+
     START_TARGET_OPERATION(thread);
     res = sched_getparam(pid, &param); 
     END_TARGET_OPERATION(thread);
@@ -146,6 +149,7 @@
     
     // Prepare
     pid = readInt(&stream);
+    errno = 0;
     
     START_TARGET_OPERATION(thread);
     res = sched_getscheduler(pid); 
@@ -168,6 +172,7 @@
     
     // Prepare
     pid = readInt(&stream);
+    errno = 0;
     
     START_TARGET_OPERATION(thread);
     res = sched_rr_get_interval(pid, &interval); 
@@ -194,6 +199,7 @@
     // Prepare
     pid = readInt(&stream);
     readSchedParam(&stream, &param);
+    errno = 0;
     
     START_TARGET_OPERATION(thread);
     res =  sched_setparam(pid, &param); 
@@ -219,7 +225,8 @@
     pid = readInt(&stream);
     policy = readInt(&stream);
     readSchedParam(&stream, &param);
-    
+    errno = 0;    
+
     START_TARGET_OPERATION(thread);
     res = sched_setscheduler(pid, policy, &param); 
     END_TARGET_OPERATION(thread);
@@ -236,6 +243,7 @@
 static TACommandVerdict sched_yield_cmd(TAThread thread,TAInputStream stream)
 {
     int res;
+    errno = 0;
     
     START_TARGET_OPERATION(thread);
     

=== modified file 'src/agent/util/search/hash_agent.c'
--- a/src/agent/util/search/hash_agent.c	2008-09-05 17:30:58 +0000
+++ b/src/agent/util/search/hash_agent.c	2012-09-09 19:27:20 +0000
@@ -137,6 +137,7 @@
 
     // Prepare
     n = readSize(&stream);
+    errno = 0;
 
     // Execute
     START_TARGET_OPERATION(thread);
@@ -193,6 +194,7 @@
 
     inEntry.key =  inKey;
     inEntry.data = inData;
+    errno = 0;
 
     START_TARGET_OPERATION(thread);
 



More information about the lsb-messages mailing list