Curious situation with unlink() and open()

D. Hugh Redelmeier hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Mon Apr 30 13:10:11 UTC 2012


| From: William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>

| How do you keep what you did with fd2?

If you want to keep it, don't delete the file.  Pretty simple, really.

What is the logic of the program such that it would delete a file that
you don't want deleted?  That's not a rhetorical question: if you can
explain the logic, you can probably code it.

One hacky solution to the problem as you posed it (not your real
problem!) would be to create a (second) hard link to the file.  Then
deleting the first link does not cause the file to be deleted.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list