mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-11 18:17:54 +00:00
Move p_realpath logic to realpath.c
This commit is contained in:
parent
c7dd0a56bf
commit
662f90e6ec
@ -26,18 +26,12 @@ typedef int GIT_SOCKET;
|
|||||||
#define p_unlink(p) unlink(p)
|
#define p_unlink(p) unlink(p)
|
||||||
#define p_mkdir(p,m) mkdir(p, m)
|
#define p_mkdir(p,m) mkdir(p, m)
|
||||||
#define p_fsync(fd) fsync(fd)
|
#define p_fsync(fd) fsync(fd)
|
||||||
|
extern char *p_realpath(const char *, char *);
|
||||||
|
|
||||||
#define p_recv(s,b,l,f) recv(s,b,l,f)
|
#define p_recv(s,b,l,f) recv(s,b,l,f)
|
||||||
#define p_send(s,b,l,f) send(s,b,l,f)
|
#define p_send(s,b,l,f) send(s,b,l,f)
|
||||||
#define p_inet_pton(a, b, c) inet_pton(a, b, c)
|
#define p_inet_pton(a, b, c) inet_pton(a, b, c)
|
||||||
|
|
||||||
/* The OpenBSD realpath function behaves differently */
|
|
||||||
#if !defined(__OpenBSD__)
|
|
||||||
# define p_realpath(p, po) realpath(p, po)
|
|
||||||
#else
|
|
||||||
char *p_realpath(const char *, char *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
|
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
|
||||||
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
|
#define p_snprintf(b, c, f, ...) snprintf(b, c, f, __VA_ARGS__)
|
||||||
#define p_mkstemp(p) mkstemp(p)
|
#define p_mkstemp(p) mkstemp(p)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <git2/common.h>
|
#include <git2/common.h>
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifndef GIT_WIN32
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -16,15 +16,16 @@
|
|||||||
char *p_realpath(const char *pathname, char *resolved)
|
char *p_realpath(const char *pathname, char *resolved)
|
||||||
{
|
{
|
||||||
char *ret;
|
char *ret;
|
||||||
|
|
||||||
if ((ret = realpath(pathname, resolved)) == NULL)
|
if ((ret = realpath(pathname, resolved)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Figure out if the file exists */
|
#ifdef __OpenBSD__
|
||||||
if (!access(ret, F_OK))
|
/* The OpenBSD realpath function behaves differently,
|
||||||
return ret;
|
* figure out if the file exists */
|
||||||
|
if (access(ret, F_OK) < 0)
|
||||||
return NULL;
|
ret = NULL;
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user