[PATCH 02/10] drop use of strerror()

nobled nobled at dreamwidth.org
Sun Jul 1 10:51:29 PDT 2012


It isn't thread-safe. Use the %m conversion specifier instead,
like the rest of the code already does.
---
 src/scanner.c        |    2 +-
 src/wayland-server.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/scanner.c b/src/scanner.c
index 83611ec..be8d3d6 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1086,7 +1086,7 @@ int main(int argc, char *argv[])
 		buf = XML_GetBuffer(ctx.parser, XML_BUFFER_SIZE);
 		len = fread(buf, 1, XML_BUFFER_SIZE, stdin);
 		if (len < 0) {
-			fprintf(stderr, "fread: %s\n", strerror(errno));
+			fprintf(stderr, "fread: %m\n");
 			exit(EXIT_FAILURE);
 		}
 		XML_ParseBuffer(ctx.parser, len, len == 0);
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 3bd427b..85d242e 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1102,7 +1102,7 @@ socket_data(int fd, uint32_t mask, void *data)
 	client_fd = wl_os_accept_cloexec(fd, (struct sockaddr *) &name,
 					 &length);
 	if (client_fd < 0)
-		wl_log("failed to accept, errno: %d\n", errno);
+		wl_log("failed to accept: %m\n");
 	else
 		wl_client_create(display, client_fd);

-- 
1.7.9.5


More information about the wayland-devel mailing list