effects/screenshot: Fix potentially leaking screenshot fds to child processes
dup() doesn't copy flags such as FD_CLOEXEC.
This commit is contained in:
parent
60dc812b21
commit
c2c229fb05
1 changed files with 7 additions and 7 deletions
|
@ -367,7 +367,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureActiveWindow(const QVariantMap &opt
|
|||
return QVariantMap();
|
||||
}
|
||||
|
||||
const int fileDescriptor = dup(pipe.fileDescriptor());
|
||||
const int fileDescriptor = fcntl(pipe.fileDescriptor(), F_DUPFD_CLOEXEC, 0);
|
||||
if (fileDescriptor == -1) {
|
||||
sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
|
||||
return QVariantMap();
|
||||
|
@ -403,7 +403,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureWindow(const QString &handle,
|
|||
return QVariantMap();
|
||||
}
|
||||
|
||||
const int fileDescriptor = dup(pipe.fileDescriptor());
|
||||
const int fileDescriptor = fcntl(pipe.fileDescriptor(), F_DUPFD_CLOEXEC, 0);
|
||||
if (fileDescriptor == -1) {
|
||||
sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
|
||||
return QVariantMap();
|
||||
|
@ -430,7 +430,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureArea(int x, int y, int width, int h
|
|||
return QVariantMap();
|
||||
}
|
||||
|
||||
const int fileDescriptor = dup(pipe.fileDescriptor());
|
||||
const int fileDescriptor = fcntl(pipe.fileDescriptor(), F_DUPFD_CLOEXEC, 0);
|
||||
if (fileDescriptor == -1) {
|
||||
sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
|
||||
return QVariantMap();
|
||||
|
@ -457,7 +457,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureScreen(const QString &name,
|
|||
return QVariantMap();
|
||||
}
|
||||
|
||||
const int fileDescriptor = dup(pipe.fileDescriptor());
|
||||
const int fileDescriptor = fcntl(pipe.fileDescriptor(), F_DUPFD_CLOEXEC, 0);
|
||||
if (fileDescriptor == -1) {
|
||||
sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
|
||||
return QVariantMap();
|
||||
|
@ -483,7 +483,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureActiveScreen(const QVariantMap &opt
|
|||
return QVariantMap();
|
||||
}
|
||||
|
||||
const int fileDescriptor = dup(pipe.fileDescriptor());
|
||||
const int fileDescriptor = fcntl(pipe.fileDescriptor(), F_DUPFD_CLOEXEC, 0);
|
||||
if (fileDescriptor == -1) {
|
||||
sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
|
||||
return QVariantMap();
|
||||
|
@ -500,7 +500,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureInteractive(uint kind,
|
|||
const QVariantMap &options,
|
||||
QDBusUnixFileDescriptor pipe)
|
||||
{
|
||||
const int fileDescriptor = dup(pipe.fileDescriptor());
|
||||
const int fileDescriptor = fcntl(pipe.fileDescriptor(), F_DUPFD_CLOEXEC, 0);
|
||||
if (fileDescriptor == -1) {
|
||||
sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
|
||||
return QVariantMap();
|
||||
|
@ -555,7 +555,7 @@ QVariantMap ScreenShotDBusInterface2::CaptureWorkspace(const QVariantMap &option
|
|||
return QVariantMap();
|
||||
}
|
||||
|
||||
const int fileDescriptor = dup(pipe.fileDescriptor());
|
||||
const int fileDescriptor = fcntl(pipe.fileDescriptor(), F_DUPFD_CLOEXEC, 0);
|
||||
if (fileDescriptor == -1) {
|
||||
sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
|
||||
return QVariantMap();
|
||||
|
|
Loading…
Reference in a new issue