Skip to content

mktmp: use fchmod for changing mode - #6160

Closed
boretrk wants to merge 1 commit into
libgit2:mainfrom
boretrk:mkstemp
Closed

mktmp: use fchmod for changing mode#6160
boretrk wants to merge 1 commit into
libgit2:mainfrom
boretrk:mkstemp

Conversation

@boretrk

@boretrk boretrk commented Jan 2, 2022

Copy link
Copy Markdown
Contributor

Using fchmod in cases where we have a filehandle allows PosixLib to work around the issue with being unable to change mode on open files on AmigaOS.
It also seems to me like it would be the better option for other systems too.
Unfortunately it seems like Windows doesn't have a direct equivalent?

@boretrk

boretrk commented Jan 6, 2022

Copy link
Copy Markdown
Contributor Author

#5350 is probably a better option

@ethomson

Copy link
Copy Markdown
Member

I think that I'm happy with #5350 if we stop rolling our own temp names. It makes me a shade uneasy.

@boretrk

boretrk commented Jan 13, 2022

Copy link
Copy Markdown
Contributor Author

I think there is a reluctance to use tempnam() based on the following text from The Open Group Base Specifications Issue 7

The tempnam() function is marked obsolescent.

An alternative could be using tmpnam() for the random part of the string since we build the prefix anyway. It is also marked obsolescent but since it is part of C99 it is unlikely to not be supported.
I'll look into it.

@boretrk boretrk closed this Jan 13, 2022
@boretrk
boretrk deleted the mkstemp branch January 31, 2022 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants