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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 27 Nov 2009 18:23:49 -0800
Colin McCabe <cmccabe@xxxxxxxxxxxxxx> wrote:

> Signed-off-by: Colin McCabe <cmccabe@xxxxxxxxxxxxxx>
> +	if (!g_file_get_contents(fname, &buf, &len, &err)) {
> +		fprintf(stderr, "Unable to read port file: %s\n",
> +			 err->message);
> +		g_error_free(err);
> +		return -EIO;
> +	}

We should not print errors from library routines, because it
leads to double-printing (so even if you swap the fprintf to
applog, it's still not a good thing to do).

Otherwise seems fine at first blush.

BTW, speaking of double-something, here's a funny buglet:

diff --git cld/server/server.c cld-tip/server/server.c
--- cld/server/server.c
+++ 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);
+		snprintf(portstr, sizeof(portstr), "%u", port);
 		return net_write_port(cld_srv.port_file, portstr);
 	}
 	return 0;

Our PID files contain a linefeed, as a courtesy to those who
examine them from a shell. But CLD's contains two.

-- Pete
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Fedora Clound]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux