mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 09:46:17 +01:00
g_unix_open_pipe: Add missing F_SETFD
Spotted by Ray Strode <rstrode@redhat.com> While we're here, microoptimize by skipping the fcntl() calls if flags is 0. https://bugzilla.gnome.org/show_bug.cgi?id=690069
This commit is contained in:
parent
5baa26be72
commit
c700721805
@ -105,7 +105,11 @@ g_unix_open_pipe (int *fds,
|
|||||||
ecode = pipe (fds);
|
ecode = pipe (fds);
|
||||||
if (ecode == -1)
|
if (ecode == -1)
|
||||||
return g_unix_set_error_from_errno (error, errno);
|
return g_unix_set_error_from_errno (error, errno);
|
||||||
ecode = fcntl (fds[0], flags);
|
|
||||||
|
if (flags == 0)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
ecode = fcntl (fds[0], F_SETFD, flags);
|
||||||
if (ecode == -1)
|
if (ecode == -1)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
@ -113,7 +117,7 @@ g_unix_open_pipe (int *fds,
|
|||||||
close (fds[1]);
|
close (fds[1]);
|
||||||
return g_unix_set_error_from_errno (error, saved_errno);
|
return g_unix_set_error_from_errno (error, saved_errno);
|
||||||
}
|
}
|
||||||
ecode = fcntl (fds[1], flags);
|
ecode = fcntl (fds[1], F_SETFD, flags);
|
||||||
if (ecode == -1)
|
if (ecode == -1)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user