Date: Mon, 19 Mar 2012 01:28:11 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r233148 - stable/7/lib/libc/string Message-ID: <201203190128.q2J1SBuC044605@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Mon Mar 19 01:28:11 2012 New Revision: 233148 URL: http://svn.freebsd.org/changeset/base/233148 Log: MFC r232503: POSIX mandates that swab do nothing when len < 0 PR: 140690 Approved by: cperciva Modified: stable/7/lib/libc/string/swab.3 stable/7/lib/libc/string/swab.c Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/string/swab.3 ============================================================================== --- stable/7/lib/libc/string/swab.3 Mon Mar 19 01:27:55 2012 (r233147) +++ stable/7/lib/libc/string/swab.3 Mon Mar 19 01:28:11 2012 (r233148) @@ -28,7 +28,7 @@ .\" @(#)swab.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 10, 2004 +.Dd March 4, 2012 .Dt SWAB 3 .Os .Sh NAME @@ -54,6 +54,9 @@ swapping adjacent bytes. The argument .Fa len must be an even number. +If +.Fa len +is less than zero, nothing will be done. .Sh SEE ALSO .Xr bzero 3 , .Xr memset 3 Modified: stable/7/lib/libc/string/swab.c ============================================================================== --- stable/7/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) +++ stable/7/lib/libc/string/swab.c Mon Mar 19 01:28:11 2012 (r233148) @@ -45,6 +45,8 @@ swab(const void * __restrict from, void int n; char *fp, *tp; + if (len <= 0) + return; n = len >> 1; fp = (char *)from; tp = (char *)to;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203190128.q2J1SBuC044605>