Re: [PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents

2009-11-28 Thread Pete Zaitcev
On Sat, 28 Nov 2009 16:23:29 -0500 Jeff Garzik wrote: > > +++ cld-tip/server/server.c > > @@ -722,7 +741,7 @@ static int net_open_any(void) > > > > if (cld_srv.port_file) { > > char portstr[7]; > > - snprintf(portstr, sizeof(portstr), "%u\n", port); > > + snpri

Re: [PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents

2009-11-28 Thread Jeff Garzik
On 11/28/2009 12:58 PM, Pete Zaitcev wrote: On Fri, 27 Nov 2009 18:23:49 -0800 Colin McCabe wrote: Signed-off-by: Colin McCabe + if (!g_file_get_contents(fname,&buf,&len,&err)) { + fprintf(stderr, "Unable to read port file: %s\n", +err->message); +

Re: [PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents

2009-11-28 Thread Pete Zaitcev
On Fri, 27 Nov 2009 18:23:49 -0800 Colin McCabe wrote: > Signed-off-by: Colin McCabe > + if (!g_file_get_contents(fname, &buf, &len, &err)) { > + fprintf(stderr, "Unable to read port file: %s\n", > + err->message); > + g_error_free(err); > +

Re: [PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents

2009-11-28 Thread Jeff Garzik
On 11/28/2009 05:37 AM, Jeff Garzik wrote: 1) 'buf' is no longer nul-terminated, which means strtol() has become a buffer overrun. Whoops, it seems I am incorrect on this, according to http://library.gnome.org/devel/glib/stable/glib-File-Utilities.html#g-file-get-contents Ignore that point. -

Re: [PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents

2009-11-28 Thread Jeff Garzik
On 11/27/2009 09:23 PM, Colin McCabe wrote: Signed-off-by: Colin McCabe --- lib/common.c | 29 +++-- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/common.c b/lib/common.c index 68f60f8..db20e2a 100644 --- a/lib/common.c +++ b/lib/common.c @@ -1

[PATCH v2 2/2] cld: read the cld.port file using g_file_get_contents

2009-11-28 Thread Colin McCabe
Signed-off-by: Colin McCabe --- lib/common.c | 29 +++-- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/common.c b/lib/common.c index 68f60f8..db20e2a 100644 --- a/lib/common.c +++ b/lib/common.c @@ -1,4 +1,5 @@ +#include #include #include