2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2015-10-26 20:26:23 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2015-11-30 21:43:37 +01:00
|
|
|
#include <stddef.h>
|
2015-10-26 20:26:23 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include "time-util.h"
|
|
|
|
|
|
|
|
int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
|
|
|
|
int fgetxattr_malloc(int fd, const char *name, char **value);
|
|
|
|
|
basic/xattr-util: do not cast ssize_t to int
gcc warns about unitialized memory access because it notices that ssize_t which
is < 0 could be cast to positive int value. We know that this can't really
happen because only -1 can be returned, but OTOH, in principle a large
*positive* value cannot be cast properly. This is unlikely too, since xattrs
cannot be too large, but it seems cleaner to just use a size_t to return the
value and avoid the cast altoghter. This makes the code simpler and gcc is
happy too.
The following warning goes away:
[113/1502] Compiling C object 'src/basic/basic@sta/xattr-util.c.o'.
In file included from ../src/basic/alloc-util.h:28:0,
from ../src/basic/xattr-util.c:30:
../src/basic/xattr-util.c: In function ‘fd_getcrtime_at’:
../src/basic/macro.h:207:60: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
UNIQ_T(A,aq) < UNIQ_T(B,bq) ? UNIQ_T(A,aq) : UNIQ_T(B,bq); \
^
../src/basic/xattr-util.c:155:19: note: ‘b’ was declared here
usec_t a, b;
^
2018-02-25 21:25:33 +01:00
|
|
|
int fgetxattrat_fake(
|
|
|
|
int dirfd,
|
|
|
|
const char *filename,
|
|
|
|
const char *attribute,
|
|
|
|
void *value, size_t size,
|
|
|
|
int flags,
|
|
|
|
size_t *ret_size);
|
2015-10-26 20:26:23 +01:00
|
|
|
|
|
|
|
int fd_setcrtime(int fd, usec_t usec);
|
|
|
|
|
|
|
|
int fd_getcrtime(int fd, usec_t *usec);
|
|
|
|
int path_getcrtime(const char *p, usec_t *usec);
|
|
|
|
int fd_getcrtime_at(int dirfd, const char *name, usec_t *usec, int flags);
|
2019-11-14 14:51:04 +01:00
|
|
|
|
|
|
|
int flistxattr_malloc(int fd, char **ret);
|