From: Yukihiro Matsumoto Date: 2004-09-18T14:09:33+09:00 Subject: Re: [PATCH] dir.c (II) Hi, In message "Johan Holmberg " on Sat, 18 Sep 2004 07:19:18 +0900, nil writes: |I noticed today that dir.c was updated in the CVS archives to fix |the problem I described in my original mail. But after looking at |the change, I think it can be improved in some ways: | |1) the "dir_chdir" call in "chdir_restore" is done | even if the first call failed. I don't think this is | "logically correct" to do: one shouldn't undo something that was | never done. See the end of the mail for a weird example (taken | from a testcase I added to the Rubytests on Rubyforge). | |2) the memory leak that was mentioned in the previous thread doesn't | seem to have been fixed in the change commited today. | |Below is a new patch that I think solves these issues. I have also |reorganized the code somewhat, so that "chdir_yield" and |"chdir_restore" are more symmetric, and renamed some variables so |the code becomes easier to read (hopefully). | |I hope the change can be useful. It's useful. Thank you. matz.