[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-tech
Subject:    Re: du close handle before exiting
From:       Ingo Schwarze <schwarze () usta ! de>
Date:       2011-12-31 18:00:02
Message-ID: 20111231180002.GD5064 () iris ! usta ! de
[Download RAW message or body]

Hi,

Loganaden Velvindron wrote on Sat, Dec 31, 2011 at 12:30:44PM -0500:

> the diff is pointless...

Well, not quite; looking at it, i found a few issues with the
fts(3) manual:

 * Use the standard sentence regarding the return value;
   it applies to this case.
 * The return value of close(2) is ignored and errno(2)
   saved and reset around it, so remove the lie.
 * The syscall that does matter is fchdir(2), not chdir(2).
   That's relevant because all the stuff dealing with file
   names is not involved.
 * Keith Bostic struggled from 1990 to 1993 to get the
   wording right on STANDARDS, and since then, the wording
   remained, but his hope was never fulfilled.  I guess it
   has turned from a hope into a lie by now.

Note that i do not attempt a complete cleanup of fts(3),
i'm just fixing the parts related to fts_close(3).
But that already seems an improvement.

OK?
  Ingo


Index: fts.3
===================================================================
RCS file: /cvs/src/lib/libc/gen/fts.3,v
retrieving revision 1.28
diff -u -p -r1.28 fts.3
--- fts.3	24 Sep 2010 13:56:32 -0000	1.28
+++ fts.3	31 Dec 2011 17:52:27 -0000
@@ -716,9 +716,7 @@ and restores the current directory to th
 .Fn fts_open
 was called to open
 .Fa ftsp .
-The
-.Fn fts_close
-function returns 0 on success or \-1 if an error occurred.
+.Rv -std fts_close
 .Sh ERRORS
 The function
 .Fn fts_open
@@ -733,10 +731,8 @@ The function
 .Fn fts_close
 may fail and set
 .Va errno
-for any of the errors specified for the library functions
-.Xr chdir 2
-and
-.Xr close 2 .
+for any of the errors specified for the library function
+.Xr fchdir 2 .
 .Pp
 The functions
 .Fn fts_read
@@ -769,12 +765,6 @@ The specified option is invalid.
 .Xr chdir 2 ,
 .Xr stat 2 ,
 .Xr qsort 3
-.Sh STANDARDS
-The
-.Nm
-API is expected to be included in a future
-.St -p1003.1-88
-revision.
 .Sh HISTORY
 The
 .Nm

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic