summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2010-03-24 14:47:46 +0000
committerkettenis <kettenis@openbsd.org>2010-03-24 14:47:46 +0000
commit0953621e5a77bb47435059ab7c5a68d18a15bfdf (patch)
treee281afc0216d40a4d7ce2bffcdb36a053846ea21 /lib/libc
parenttests for ${name#pat} and ${name%pat} issue. (diff)
downloadwireguard-openbsd-0953621e5a77bb47435059ab7c5a68d18a15bfdf.tar.xz
wireguard-openbsd-0953621e5a77bb47435059ab7c5a68d18a15bfdf.zip
Modify example not to use an assignment in the if statement. We shouldn't
teach people bad habits! ok krw@, jmc@, dlg@, thib@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/string/strdup.37
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/string/strdup.3 b/lib/libc/string/strdup.3
index 5ef38e38f3e..60a74627771 100644
--- a/lib/libc/string/strdup.3
+++ b/lib/libc/string/strdup.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: strdup.3,v 1.14 2007/05/31 19:19:32 jmc Exp $
+.\" $OpenBSD: strdup.3,v 1.15 2010/03/24 14:47:46 kettenis Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: March 24 2010 $
.Dt STRDUP 3
.Os
.Sh NAME
@@ -59,7 +59,8 @@ to an allocated area of memory containing the NUL-terminated string
.Bd -literal -offset indent
char *p;
-if ((p = strdup("foobar")) == NULL) {
+p = strdup("foobar");
+if (p == NULL) {
fprintf(stderr, "Out of memory.\en");
exit(1);
}