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
ecode = pipe (fds);
if (ecode == -1)
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)
{
int saved_errno = errno;
close (fds[1]);
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)
{
int saved_errno = errno;