mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 04:50:07 +01:00
core: use nm_io_fcntl_setfl_update_nonblock() helper
This commit is contained in:
parent
f4943e07f1
commit
ce414933a7
2 changed files with 5 additions and 14 deletions
|
|
@ -5090,7 +5090,6 @@ nm_utils_spawn_helper(const char *const *args,
|
|||
gs_free_error GError *error = NULL;
|
||||
gs_free char *commands = NULL;
|
||||
HelperInfo *info;
|
||||
int fd_flags;
|
||||
const char *const *arg;
|
||||
GMainContext *context;
|
||||
gsize n;
|
||||
|
|
@ -5162,13 +5161,9 @@ nm_utils_spawn_helper(const char *const *args,
|
|||
nm_g_timeout_source_new_seconds(20, G_PRIORITY_DEFAULT, helper_timeout, info, NULL);
|
||||
g_source_attach(info->timeout_source, context);
|
||||
|
||||
/* Set file descriptors as non-blocking */
|
||||
fd_flags = fcntl(info->child_stdin, F_GETFL, 0);
|
||||
fcntl(info->child_stdin, F_SETFL, fd_flags | O_NONBLOCK);
|
||||
fd_flags = fcntl(info->child_stdout, F_GETFL, 0);
|
||||
fcntl(info->child_stdout, F_SETFL, fd_flags | O_NONBLOCK);
|
||||
fd_flags = fcntl(info->child_stderr, F_GETFL, 0);
|
||||
fcntl(info->child_stderr, F_SETFL, fd_flags | O_NONBLOCK);
|
||||
nm_io_fcntl_setfl_update_nonblock(info->child_stdin);
|
||||
nm_io_fcntl_setfl_update_nonblock(info->child_stdout);
|
||||
nm_io_fcntl_setfl_update_nonblock(info->child_stderr);
|
||||
|
||||
/* Watch process stdin */
|
||||
for (n = 1, arg = args; *arg; arg++)
|
||||
|
|
|
|||
|
|
@ -499,7 +499,6 @@ out:
|
|||
static void
|
||||
begin_authentication(AuthRequest *request)
|
||||
{
|
||||
int fd_flags;
|
||||
const char *helper_argv[] = {
|
||||
POLKIT_AGENT_HELPER_1_PATH,
|
||||
request->username,
|
||||
|
|
@ -534,11 +533,8 @@ begin_authentication(AuthRequest *request)
|
|||
return;
|
||||
}
|
||||
|
||||
fd_flags = fcntl(request->child_stdin, F_GETFL, 0);
|
||||
fcntl(request->child_stdin, F_SETFL, fd_flags | O_NONBLOCK);
|
||||
|
||||
fd_flags = fcntl(request->child_stdout, F_GETFL, 0);
|
||||
fcntl(request->child_stdout, F_SETFL, fd_flags | O_NONBLOCK);
|
||||
nm_io_fcntl_setfl_update_nonblock(request->child_stdin);
|
||||
nm_io_fcntl_setfl_update_nonblock(request->child_stdout);
|
||||
|
||||
request->child_stdout_watch_source = nm_g_unix_fd_source_new(request->child_stdout,
|
||||
G_IO_IN | G_IO_ERR | G_IO_HUP,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue