| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
These new functions optionally create symlink of relative path.
|
| |
|
|
|
|
|
|
| |
This is a wrapper around openat(). It works mostly the same, except for
one thing: it race-freely reports whether we just created the indicated
file in case O_CREAT is passed without O_EXCL.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
No changes in code, just some splitting out.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal is to move everything that requires selinux or smack
away from src/basic/. This means that src/basic/label.[ch] must move,
which implies btrfs-util.[ch], copy.[ch], and a bunch of other files
which form a cluster of internal use.
This is just moving text around, so there should be no functional difference.
test-blockdev-util is new, because path_is_encrypted() is moved to
blockdev-util.c, and so far we didn't have any tests for code there.
|
|
|
|
|
|
|
|
|
|
|
| |
Add the '=' action modifier that instructs tmpfiles.d to check the file
type of a path and remove objects that do not match before trying to
open or create the path.
BUG=chromium:1186405
TEST=./test/test-systemd-tmpfiles.py "$(which systemd-tmpfiles)"
Change-Id: If807dc0db427393e9e0047aba640d0d114897c26
|
|
|
|
| |
This will be used in sysusers later on.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On some conditions (particularly when mobile CPUs are going to sleep),
the posix_fallocate(), which is called when a new journal file is allocated,
can return -1 (EINTR). This is counted as a fatal error. So the journald
closes both old and journals, and simply throwing away further incoming
events, because of no log files open.
Introduce posix_fallocate_loop() that restarts the function in the case
of EINTR. Also let's make code base more uniform by returning negative
values on error.
Fix assert in test-sigbus.c that incorrectly counted positive values as
success. After changing the function return values, that will actually work.
Fixes: #19041
Signed-off-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
|
|
|
|
| |
Another batch of fixes (mostly) generated by Coccinelle.
|
|
|
|
| |
And this introduces conservative_rename() which does not take dirfd.
|
|
|
|
|
|
| |
Let#s make these helpers useful even without _cleanup_ logic, to destory
arbitary fields: make them OK wiht a NULL pointer as input, and always
return one as output.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Functions defined by us are supposed to return negative errno-style
errors on errors. laccess() is for access() what lstat() is for stat(),
but defined by us as a macro. This led to some confusion regarding error
handling.
Let's return a negative errno code just in case. This means callers can
it use either way: like access(), i.e. checking for a negative return
value + looking at errno, or like our own code, i.e. using the negative
errno code it returns.
|
|
|
|
|
|
|
|
| |
if the source and destination file match in contents and basic file
attributes, don#t rename, but just remove source.
This is a simple way to suppress inotify events + mtime changes when
atomically updating files.
|
| |
|
|\
| |
| | |
Read /etc/login.defs
|
| | |
|
|/
|
|
| |
futimens() that works for O_PATH fds.
|
| |
|
| |
|
|
|
|
| |
With that it becomes useful for deleting password files and such.
|
|
|
|
| |
encrypted
|
|
|
|
| |
Fixes #15436.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
chase_symlinks() would return negative on error, and either a non-negative status
or a non-negative fd when CHASE_OPEN was given. This made the interface quite
complicated, because dependning on the flags used, we would get two different
"types" of return object. Coverity was always confused by this, and flagged
every use of chase_symlinks() without CHASE_OPEN as a resource leak (because it
would this that an fd is returned). This patch uses a saparate output parameter,
so there is no confusion.
(I think it is OK to have functions which return either an error or an fd. It's
only returning *either* an fd or a non-fd that is confusing.)
|
|
|
|
|
|
|
|
| |
The default message for ENOSPC is very misleading: it says that the disk is
filled, but in fact the inotify watch limit is the problem.
So let's introduce and use a wrapper that simply calls inotify_add_watch(2) and
which fixes the error message up in case ENOSPC is returned.
|
|\
| |
| | |
Chase symlinks testing
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
$ build/test-chase-symlinks /etc/os-release
/etc/os-release → /usr/lib/os-release
$ build/test-chase-symlinks --nofollow /etc/os-release /etc/../etc/os-release /etc/../etc/./././os-release
/etc/os-release → /etc/os-release
/etc/../etc/os-release → /etc/os-release
/etc/../etc/./././os-release → /etc/os-release
|
| | |
|
|/
|
|
|
| |
We usually combine an fsync() with fsync_directory_of_file() hence let's
add a helper that does both in one.
|
| |
|
|
|
|
|
| |
fix error:
| error: passing argument 5 of 'chase_symlinks_and_stat' from incompatible pointer type [-Werror=incompatible-pointer-types]
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This flag can be used to make chase_symlinks() emit a warning when it
encounters an error.
Such flag can be useful for generating a comprehensive and detailed warning
since chase_symlinks() can generate a warning with a full context.
For now only warnings for unsafe transitions are produced.
|
|
|
|
|
|
| |
This is the counterpiece to the boot counting implemented in
systemd-boot: if a boot is detected as successful we mark drop the
counter again from the booted snippet or kernel image.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This flag mimics what "O_NOFOLLOW|O_PATH" does for open(2) that is
chase_symlinks() will not resolve the final pathname component if it's a
symlink and instead will return a file descriptor referring to the symlink
itself.
Note: if CHASE_SAFE is also passed, no safety checking is performed on the
transition done if the symlink would have been followed.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We often open the parent directory of a path. Let's add a common helper
for that, that shortens our code a bit and adds some extra safety
checks, for example it will fail if used on the root directory (which
doesn't really have a parent).
The helper is actually generalized from a function in btrfs-util.[ch]
which already existed for this purpose.
|