aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-12-31 06:43:06 -0500
committerMike Frysinger <vapier@gentoo.org>2008-12-31 06:43:06 -0500
commite44be81ea43780f5925b71401bd219dfb5ef2d1c (patch)
tree32fb9a3959eb8c0bb0f1f98ac2f3d2b3508db41a /libsbutil
parentlibsbutil: simplify get_tmp_dir code a little (diff)
downloadsandbox-e44be81ea43780f5925b71401bd219dfb5ef2d1c.tar.gz
sandbox-e44be81ea43780f5925b71401bd219dfb5ef2d1c.tar.bz2
sandbox-e44be81ea43780f5925b71401bd219dfb5ef2d1c.zip
libsbutil: sb_close(): only reset errno when close() worked
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsbutil')
-rw-r--r--libsbutil/sb_close.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libsbutil/sb_close.c b/libsbutil/sb_close.c
index 003f9ad..17a4560 100644
--- a/libsbutil/sb_close.c
+++ b/libsbutil/sb_close.c
@@ -24,7 +24,8 @@ int sb_close(int fd)
} while ((res < 0) && (EINTR == errno));
/* Do not care about errors here */
- errno = 0;
+ if (-1 != res)
+ errno = 0;
return res;
}