mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Use memcpy rather than strncpy/strncat to avoid compiler warnings
This commit is contained in:
parent
1906093efd
commit
679272b50c
1 changed files with 9 additions and 3 deletions
|
@ -1982,10 +1982,16 @@ failure:
|
|||
{
|
||||
int desc;
|
||||
int mask;
|
||||
int length;
|
||||
|
||||
strncpy(thePath, theRealPath, sizeof(thePath) - 7);
|
||||
thePath[sizeof(thePath) - 7] = '\0';
|
||||
strncat(thePath, "XXXXXX", 6);
|
||||
length = strlen(theRealPath);
|
||||
if (length > sizeof(thePath) - 7)
|
||||
{
|
||||
length = sizeof(thePath) - 7;
|
||||
}
|
||||
memcpy(thePath, theRealPath, length);
|
||||
memcpy(thePath + length, "XXXXXX", 6);
|
||||
thePath[length + 6] = '\0';
|
||||
if ((desc = mkstemp(thePath)) < 0)
|
||||
{
|
||||
NSWarnMLog(@"mkstemp (%s) failed - %@", thePath, [NSError _last]);
|
||||
|
|
Loading…
Reference in a new issue