forked from systemd/systemd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs-utils: new wrapper fd_reopen_propagate_append_and_position()
We may want to propagate O_APPEND, or (try to) keep the current file position, even if we use fd_reopen() to re-initialize (and "unshare") other file description status. For now, used only with --pty to keep/propagate O_APPEND (and/or) position if set on stdin/stdout. If we re-open stdout and "drop" the O_APPEND, we get rather "unexpected" behavior, for example with repeated "systemd-run --pty >> some-log". If someone carefully pre-positioned the passed in original file descriptors, we avoid surprises if we do not reset file postition to zero. fcntl F_GETFL first, and propagate O_APPEND if present in the existing flags. Then use lseek to propagate the file position.
- Loading branch information
1 parent
d3d880e
commit b8e25bf
Showing
3 changed files
with
52 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters