mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
export-tar: refuse to write tar to a TTY
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "runtime-scope.h"
|
||||
#include "signal-util.h"
|
||||
#include "string-util.h"
|
||||
#include "terminal-util.h"
|
||||
#include "verbs.h"
|
||||
|
||||
static ImportCompressType arg_compress = IMPORT_COMPRESS_UNKNOWN;
|
||||
@@ -93,6 +94,9 @@ static int export_tar(int argc, char *argv[], void *userdata) {
|
||||
} else {
|
||||
_cleanup_free_ char *pretty = NULL;
|
||||
|
||||
if (isatty_safe(STDOUT_FILENO))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EBADF), "Refusing to write archive to TTY.");
|
||||
|
||||
fd = STDOUT_FILENO;
|
||||
|
||||
(void) fd_get_path(fd, &pretty);
|
||||
|
||||
Reference in New Issue
Block a user