server: Fix compile error on FreeBSD/NetBSD.
F_GETPATH is currently only implemented on macOS. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56047
This commit is contained in:
parent
2c14e0777a
commit
6b4eae4088
1 changed files with 6 additions and 6 deletions
|
@ -723,18 +723,18 @@ static unsigned int filter_from_inode( struct inode *inode, int is_parent )
|
|||
|
||||
static char *get_path_from_fd( int fd, int sz )
|
||||
{
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#ifdef linux
|
||||
char *ret = malloc( 32 + sz );
|
||||
|
||||
if (ret) sprintf( ret, "/proc/self/fd/%u", fd );
|
||||
return ret;
|
||||
#elif defined(F_GETPATH)
|
||||
char *ret = malloc( PATH_MAX + sz );
|
||||
|
||||
if (!ret) return NULL;
|
||||
if (!fcntl( fd, F_GETPATH, ret )) return ret;
|
||||
free( ret );
|
||||
return NULL;
|
||||
#elif defined(linux)
|
||||
char *ret = malloc( 32 + sz );
|
||||
|
||||
if (ret) sprintf( ret, "/proc/self/fd/%u", fd );
|
||||
return ret;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue