Patchwork [1/1] Remove unnecessary strlen in qga/channel-posix.c

login
register
mail settings
Submitter Crístian Viana
Date July 6, 2012, 8:12 p.m.
Message ID <1341605546-3774-1-git-send-email-vianac@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/169537/
State New
Headers show

Comments

Crístian Viana - July 6, 2012, 8:12 p.m.
The third parameter of unix_listen in the line:

int fd = unix_listen(path, NULL, strlen(path));

makes an unnecessary call to strlen. That parameter will not be used unless
the second parameter is not NULL, which is not the case here.
---
 qga/channel-posix.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index 57eea06..ba9c8a6 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -181,7 +181,7 @@  static gboolean ga_channel_open(GAChannel *c, const gchar *path, GAChannelMethod
         break;
     }
     case GA_CHANNEL_UNIX_LISTEN: {
-        int fd = unix_listen(path, NULL, strlen(path));
+        int fd = unix_listen(path, NULL, 0);
         if (fd == -1) {
             g_critical("error opening path: %s", strerror(errno));
             return false;