delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/09/16/20:55:05

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX18QJUkNtpEQ4TVJFNcXBSqHiWOoNIRyn26iAnAKz3
QA8h8yjBsKgRin
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: djgpp-workers AT delorie DOT com
Subject: Return value of endmntent()
Date: Sat, 17 Sep 2011 02:50:10 +0200
User-Agent: KMail/1.9.10
MIME-Version: 1.0
Message-Id: <201109170250.11147.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

According to the documentation of endmntent() I have read in my Linux system
and in djgpp, this function always returns 1.  The implementation returns a
NULL pointer.  This contarticts the function definition and the documentation.
See patch below.  Shall this function always return 1 or shall it return something
different in case of error?  In the current form the code does not compile.
Suggestions are welcome.

Regards,
Juan M. Guerrero



Index: djgpp/src/libc/compat/mntent/mntent.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/mntent/mntent.c,v
retrieving revision 1.11
diff -U 5 -r1.11 mntent.c
--- djgpp/src/libc/compat/mntent/mntent.c	2 Aug 2009 05:37:01 -0000	1.11
+++ djgpp/src/libc/compat/mntent/mntent.c	17 Sep 2011 00:41:23 -0000
@@ -869,11 +869,11 @@
 endmntent(FILE *filep)
 {
   if (filep != (FILE *)1)
     {
       errno = EBADF;    /* fake errno for invalid handle */
-      return NULL;
+      return 1;
     }
   drive_number = 0;
   skip_drive_b = 0;
   return 1;
 }

- Raw text -


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