Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
45a3b9cd
Commit
45a3b9cd
authored
Apr 24, 2018
by
Matt Keeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: fix issue with /tmp paths on macOS[1]
parent
0eca4230
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
tests/clar/sandbox.h
+12
-0
No files found.
tests/clar/sandbox.h
View file @
45a3b9cd
#ifdef __APPLE__
#include <sys/syslimits.h>
#endif
static
char
_clar_path
[
4096
];
static
char
_clar_path
[
4096
];
static
int
static
int
...
@@ -31,6 +35,10 @@ find_tmp_path(char *buffer, size_t length)
...
@@ -31,6 +35,10 @@ find_tmp_path(char *buffer, size_t length)
continue
;
continue
;
if
(
is_valid_tmp_path
(
env
))
{
if
(
is_valid_tmp_path
(
env
))
{
#ifdef __APPLE__
if
(
length
>=
PATH_MAX
&&
realpath
(
env
,
buffer
)
!=
NULL
)
return
0
;
#endif
strncpy
(
buffer
,
env
,
length
);
strncpy
(
buffer
,
env
,
length
);
return
0
;
return
0
;
}
}
...
@@ -38,6 +46,10 @@ find_tmp_path(char *buffer, size_t length)
...
@@ -38,6 +46,10 @@ find_tmp_path(char *buffer, size_t length)
/* If the environment doesn't say anything, try to use /tmp */
/* If the environment doesn't say anything, try to use /tmp */
if
(
is_valid_tmp_path
(
"/tmp"
))
{
if
(
is_valid_tmp_path
(
"/tmp"
))
{
#ifdef __APPLE__
if
(
length
>=
PATH_MAX
&&
realpath
(
"/tmp"
,
buffer
)
!=
NULL
)
return
0
;
#endif
strncpy
(
buffer
,
"/tmp"
,
length
);
strncpy
(
buffer
,
"/tmp"
,
length
);
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment