Page MenuHomeFreeBSD

Add mkostempsat(3).
ClosedPublic

Authored by markj on Jul 22 2019, 8:30 PM.
Tags
None
Referenced Files
F103468137: D21031.id60036.diff
Mon, Nov 25, 10:23 AM
Unknown Object (File)
Sun, Nov 24, 12:21 AM
Unknown Object (File)
Sun, Nov 24, 12:21 AM
Unknown Object (File)
Sat, Nov 23, 10:26 PM
Unknown Object (File)
Sat, Nov 23, 4:48 PM
Unknown Object (File)
Sat, Nov 23, 2:03 AM
Unknown Object (File)
Fri, Nov 22, 7:44 PM
Unknown Object (File)
Fri, Nov 22, 5:55 AM
Subscribers

Details

Summary

This is a variant of mkostemps() which takes a directory descriptor and
returns a descriptor for a file relative to that directory. This allows
easier capsicumization of some applications.

My particular use-case is strip(1), which processes each of its input
files, storing the result in a tempfile, and renames each tempfile back
over the corresponding input file.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/libc/stdio/mktemp.c
163 ↗(On Diff #60032)

Does there need to be a AT_FDCWD case here to match the manpage?

LGTM other than the issue brooks noticed.

lib/libc/stdio/mktemp.c
163 ↗(On Diff #60032)

Yes, I think so.

  • Use AT_FDCWD when no relative dfd is specified.
  • Add a man page mlink.
markj added inline comments.
lib/libc/stdio/mktemp.c
163 ↗(On Diff #60032)

The new block isn't really needed at all. The non-"at" mktemp functions can specify AT_FDCWD as the directory fd, which lets me get rid of the branches that I had added.

cem added inline comments.
lib/libc/stdio/mktemp.c
163–164 ↗(On Diff #60036)

Seems like a weird spelling of strrchr? Preexisting issue.

This revision is now accepted and ready to land.Jul 23 2019, 5:36 AM
markj added inline comments.
lib/libc/stdio/mktemp.c
163–164 ↗(On Diff #60036)

Yeah. I'm also not sure why exactly we need this check in the first place.

This revision was automatically updated to reflect the committed changes.