summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkleink <kleink@NetBSD.org>2001-10-23 18:45:13 +0000
committerkleink <kleink@NetBSD.org>2001-10-23 18:45:13 +0000
commit04b133da92ede65dd17d7ea583cdc1297dcb2ba1 (patch)
treefcd2e6e96720203a346ce804ef2960a7a8ec3ca4
parentb159dba912cb149dcb9e0427ec436dd013500325 (diff)
As discussed with Luke, add a short _DIAGASSERT(3) example.
Fixes PR lib/14324.
-rw-r--r--share/misc/style11
1 files changed, 9 insertions, 2 deletions
diff --git a/share/misc/style b/share/misc/style
index a3e621e09c1..2e69a72ff01 100644
--- a/share/misc/style
+++ b/share/misc/style
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.18 2001/02/21 00:04:43 cgd Exp $ */
+/* $NetBSD: style,v 1.19 2001/10/23 18:45:13 kleink Exp $ */
/*
* The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
#ifndef __lint
__COPYRIGHT("@(#) Copyright (c) 2000\n\
The NetBSD Foundation, inc. All rights reserved.\n");
-__RCSID("$NetBSD: style,v 1.18 2001/02/21 00:04:43 cgd Exp $");
+__RCSID("$NetBSD: style,v 1.19 2001/10/23 18:45:13 kleink Exp $");
#endif /* !__lint */
/*
@@ -344,6 +344,13 @@ dirinfo(const char *p, struct stat *sb, struct dirent *de, struct statfs *sf,
int *rargc, char **rargv[])
{ /* Insert an empty line if the function has no local variables. */
+ /*
+ * In system libraries, catch obviously invalid function arguments
+ * using _DIAGASSERT(3).
+ */
+ _DIAGASSERT(p != NULL);
+ _DIAGASSERT(filedesc != -1);
+
if (stat(p, sb) < 0)
err(1, "Unable to stat %s", p);