Page MenuHomeFreeBSD

Add mkostempsat(3).
ClosedPublic

Authored by markj on Jul 22 2019, 8:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 11 2024, 5:39 AM
Unknown Object (File)
Mar 11 2024, 5:39 AM
Unknown Object (File)
Mar 11 2024, 5:39 AM
Unknown Object (File)
Mar 11 2024, 5:39 AM
Unknown Object (File)
Mar 7 2024, 10:09 PM
Unknown Object (File)
Feb 14 2024, 3:00 AM
Unknown Object (File)
Jan 3 2024, 5:57 PM
Unknown Object (File)
Jan 3 2024, 5:56 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25464
Build 24084: arc lint + arc unit

Event Timeline

lib/libc/stdio/mktemp.c
172

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
172

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
172

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

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

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.