delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/12/29/06:52:19

Message-Id: <5.0.2.1.0.20001229064857.00a840a0@pop5.banet.net>
X-Sender: usbanet DOT farley3 AT pop5 DOT banet DOT net (Unverified)
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Fri, 29 Dec 2000 06:53:07 -0500
To: djgpp-workers AT delorie DOT com
From: "Peter J. Farley III" <pjfarley AT banet DOT net>
Subject: fcntl locking changes #3: Patch for strerror
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

--=====================_12133697==_
Content-Type: text/plain; charset="us-ascii"; format=flowed

As part of the little things fixed during my fcntl work, here is a 
patch for strerror.c to eliminate the use of a "magic number" of 
characters to copy.

--=====================_12133697==_
Content-Type: text/plain; charset="us-ascii"

diff -ruN djgpp-cvs/src/libc/ansi/string/strerror.c djgpp/src/libc/ansi/string/strerror.c
--- djgpp-cvs/src/libc/ansi/string/strerror.c	Fri Jun 16 04:16:48 1995
+++ djgpp/src/libc/ansi/string/strerror.c	Mon Dec 11 21:56:58 2000
@@ -1,3 +1,4 @@
+/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <stdio.h>
 #include <string.h>
@@ -15,7 +16,7 @@
     return(unconst(__sys_errlist[errnum], char *));
 
   strcpy(ebuf, "Unknown error: ");
-  cp = ebuf + 15;
+  cp = ebuf + strlen(ebuf);
   if (errnum < 0)
   {
     *cp++ = '-';

--=====================_12133697==_
Content-Type: text/plain; charset="us-ascii"; format=flowed

---------------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org OR
                      pjfarley AT banet DOT net)
--=====================_12133697==_--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019