-
Notifications
You must be signed in to change notification settings - Fork 0
/
__fxstat64.c
51 lines (39 loc) · 872 Bytes
/
__fxstat64.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Copyright 2021-2024 Gaël PORTAY
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifdef __linux__
#include <stdio.h>
#include <errno.h>
#include <dlfcn.h>
#include <sys/xattr.h>
#include <fcntl.h>
#include <sys/stat.h>
#include "iamroot.h"
#ifdef _LARGEFILE64_SOURCE
static int (*sym)(int, int, struct stat64 *);
int next___fxstat64(int ver, int fd, struct stat64 *statbuf)
{
if (!sym)
sym = dlsym(RTLD_NEXT, "__fxstat64");
if (!sym)
return __dl_set_errno_and_perror(ENOSYS, -1);
return sym(ver, fd, statbuf);
}
int __fxstat64(int ver, int fd, struct stat64 *statbuf)
{
int ret;
ret = next___fxstat64(ver, fd, statbuf);
if (ret == -1)
goto exit;
__fst_mode(fd, statbuf);
__fst_uid(fd, statbuf);
__fst_gid(fd, statbuf);
exit:
__debug("%s(fd: %i <-> '%s', ...) -> %i\n", __func__, fd, __fpath(fd),
ret);
return ret;
}
#endif
#endif