Bug 200942

Summary: fts_children doesn't preserve errno after running close/fchdir
Product: Base System Reporter: Enji Cooper <ngie>
Component: binAssignee: Jilles Tjoelker <jilles>
Status: Closed FIXED    
Severity: Affects Many People CC: benno, cse.cem, jilles, markj
Priority: --- Flags: jilles: mfc-stable10+
jilles: mfc-stable9-
jilles: mfc-stable8-
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Enji Cooper freebsd_committer 2015-06-17 21:58:36 UTC
Noticed in an internal code review -- in particular mjohnston noted that fts_open doesn't preserve the errno after close/fchdir is called and Conrad Meyer confirmed it: https://svnweb.freebsd.org/base/head/lib/libc/gen/fts.c?view=annotate#l571

This might be the root cause behind a handful of other bugs with rm related to fts_open, etc.

Spotted by: mjohnston
In collaboration with: Conrad Meyer
Comment 1 Conrad Meyer 2015-06-17 22:58:30 UTC
https://reviews.freebsd.org/D2852
Comment 2 commit-hook freebsd_committer 2015-06-20 20:54:23 UTC
A commit references this bug:

Author: jilles
Date: Sat Jun 20 20:54:05 UTC 2015
New revision: 284649
URL: https://svnweb.freebsd.org/changeset/base/284649

Log:
  fts_children: preserve errno after running close/fchdir

  PR:		200942
  Submitted by:	Conrad Meyer
  Differential Revision: https://reviews.freebsd.org/D2852
  MFC after:	1 week

Changes:
  head/lib/libc/gen/fts.c
Comment 3 commit-hook freebsd_committer 2015-08-09 15:53:20 UTC
A commit references this bug:

Author: jilles
Date: Sun Aug  9 15:53:03 UTC 2015
New revision: 286534
URL: https://svnweb.freebsd.org/changeset/base/286534

Log:
  MFC r284649: fts_children: preserve errno after running close/fchdir

  PR:		200942
  Submitted by:	Conrad Meyer

Changes:
_U  stable/10/
  stable/10/lib/libc/gen/fts.c