/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "alloc-util.h"
#include "fd-util.h"
#include "macro.h"
#include "sparse-endian.h"
#include "stdio-util.h"
#include "time-util.h"
#include "xattr-util.h"
char *v;
size_t l;
ssize_t n;
v = new0(char, l);
if (!v)
return -ENOMEM;
if (allow_symlink)
else
if (n >= 0 && (size_t) n < l) {
*value = v;
return n;
}
free(v);
return -errno;
if (allow_symlink)
else
if (n < 0)
return -errno;
}
}
char *v;
size_t l;
ssize_t n;
v = new0(char, l);
if (!v)
return -ENOMEM;
if (n >= 0 && (size_t) n < l) {
*value = v;
return n;
}
free(v);
return -errno;
if (n < 0)
return -errno;
}
}
ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags) {
ssize_t l;
/* The kernel doesn't have a fgetxattrat() command, hence let's emulate one */
fd = openat(dirfd, filename, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_PATH|(flags & AT_SYMLINK_NOFOLLOW ? O_NOFOLLOW : 0));
if (fd < 0)
return -errno;
if (l < 0)
return -errno;
return l;
}
uint64_t u;
if (u == 0 || u == (uint64_t) -1)
return -EIO;
return 0;
}
ssize_t n;
* let's fake one with xattrs */
if (n < 0)
return -errno;
if (n != sizeof(le))
return -EIO;
}
ssize_t n;
if (n < 0)
return -errno;
if (n != sizeof(le))
return -EIO;
}
ssize_t n;
assert(p);
if (n < 0)
return -errno;
if (n != sizeof(le))
return -EIO;
}
if (usec <= 0)
return -errno;
return 0;
}