diff options
author | edwin <edwin@FreeBSD.org> | 2010-06-05 12:49:39 +0000 |
---|---|---|
committer | edwin <edwin@FreeBSD.org> | 2010-06-05 12:49:39 +0000 |
commit | 9f84f214655d7a831646a76487e371a3057b9e19 (patch) | |
tree | 837092c52c2cade93db6fdc57b6eff6cbb3d6493 /usr.sbin/tzsetup | |
parent | b69bd664561d7c2d7d6c937341b5e4790a24b0cc (diff) | |
download | FreeBSD-src-9f84f214655d7a831646a76487e371a3057b9e19.zip FreeBSD-src-9f84f214655d7a831646a76487e371a3057b9e19.tar.gz |
When there is a problem with writing, also bail out.
Found with the clang checker.
Diffstat (limited to 'usr.sbin/tzsetup')
-rw-r--r-- | usr.sbin/tzsetup/tzsetup.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/tzsetup/tzsetup.c b/usr.sbin/tzsetup/tzsetup.c index 0ab7a2b..14b9a7f 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"); |