Hi guys... Just wanted to see what is so different in BSD from Linux and had a quick look at the openbsd-compat directory (openssh-2.5.1p1). There is a REALLY obvious bug in bsd-misc.c, quoted below: #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR) const char *strerror(int e) { extern int sys_nerr; extern char *sys_errlist[]; if ((e >= 0) || (e < sys_nerr)) return("unlisted error"); else return(sys_errlist[e]); } #endif (Shouldn't the return statements be swapped?!) Regards, wwieser
On Mon, 12 Mar 2001 wwieser at gmx.de wrote:> Hi guys... > > Just wanted to see what is so different in BSD from Linux and had a > quick look at the openbsd-compat directory (openssh-2.5.1p1). > > There is a REALLY obvious bug in bsd-misc.c, quoted below: > > #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && > defined(HAVE_SYS_NERR) > const char *strerror(int e) > { > extern int sys_nerr; > extern char *sys_errlist[]; > > if ((e >= 0) || (e < sys_nerr)) > return("unlisted error"); > else > return(sys_errlist[e]); > } > #endif > > (Shouldn't the return statements be swapped?!) >I believe so. Looking at: http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/__strerror.c?rev=1.6 It seems that they should be. However, I'm interested in how you ran across this with Linux since Linux has a built in strerror(). =) - Ben
Seemingly Similar Threads
- patch for getting 2.1.1p4 to compile on SunOS 4
- [PATCH libnbd v2 1/2] lib: Don't use perror after fork in nbd_connect_callback.
- Re: [PATCH libnbd v2 1/2] lib: Don't use perror after fork in nbd_connect_callback.
- [openssh-1.2.2] some porting notes for SunOS 4.1.4
- [PATCH libnbd v2 0/2] Implement systemd socket activation.