summaryrefslogtreecommitdiffstats
path: root/sys/lib/libsa/stat.c
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>1997-04-02 05:21:48 +0000
committermickey <mickey@openbsd.org>1997-04-02 05:21:48 +0000
commit60784ed2bcaa02d6b56d2a5112109fb8a7ccf169 (patch)
tree09b4ec83b2a158ce701780be326e80bf749aa913 /sys/lib/libsa/stat.c
parentfd < 0 is evil (diff)
downloadwireguard-openbsd-60784ed2bcaa02d6b56d2a5112109fb8a7ccf169.tar.xz
wireguard-openbsd-60784ed2bcaa02d6b56d2a5112109fb8a7ccf169.zip
don't use cread's open/close. stat does not need libz. save memory
Diffstat (limited to 'sys/lib/libsa/stat.c')
-rw-r--r--sys/lib/libsa/stat.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/lib/libsa/stat.c b/sys/lib/libsa/stat.c
index c5167b3304e..bdda62de0c7 100644
--- a/sys/lib/libsa/stat.c
+++ b/sys/lib/libsa/stat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stat.c,v 1.3 1996/09/23 14:19:05 mickey Exp $ */
+/* $OpenBSD: stat.c,v 1.4 1997/04/02 05:21:48 mickey Exp $ */
/* $NetBSD: stat.c,v 1.3 1994/10/26 05:45:07 cgd Exp $ */
/*-
@@ -45,10 +45,17 @@ stat(str, sb)
{
int fd, rv;
- fd = open(str, 0);
- if (fd < 0)
+#ifdef __INTERNAL_LIBSA_CREAD
+ if ((fd = oopen(str, 0)) < 0)
+#else
+ if ((fd = open(str, 0)) < 0)
+#endif
return (-1);
rv = fstat(fd, sb);
+#ifdef __INTERNAL_LIBSA_CREAD
+ (void)oclose(fd);
+#else
(void)close(fd);
+#endif
return (rv);
}