From 3b8d8bd75e4d9f69dff078687297af45f99d6094 Mon Sep 17 00:00:00 2001 From: Edwin Groothuis Date: Sat, 5 Jun 2010 12:49:39 +0000 Subject: [PATCH] When there is a problem with writing, also bail out. Found with the clang checker. --- usr.sbin/tzsetup/tzsetup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 0ab7a2b519e2..14b9a7f3f140 100644 --- a/usr.sbin/tzsetup/tzsetup.c +++ b/usr.sbin/tzsetup/tzsetup.c @@ -564,7 +564,8 @@ install_zoneinfo_file(const char *zoneinfo_file) } while ((len = read(fd1, buf, sizeof(buf))) > 0) - len = write(fd2, buf, len); + if ((len = write(fd2, buf, len)) < 0) + break; if (len == -1) { snprintf(title, sizeof(title), "Error");