Page MenuHomeFreeBSD

Add mkostempsat(3).
ClosedPublic

Authored by markj on Jul 22 2019, 8:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 11, 1:17 AM
Unknown Object (File)
Sat, Nov 30, 11:47 PM
Unknown Object (File)
Sat, Nov 30, 9:08 PM
Unknown Object (File)
Nov 25 2024, 5:02 PM
Unknown Object (File)
Nov 25 2024, 10:23 AM
Unknown Object (File)
Nov 24 2024, 12:21 AM
Unknown Object (File)
Nov 24 2024, 12:21 AM
Unknown Object (File)
Nov 23 2024, 10:26 PM
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.