From: Lennart Poettering Date: Fri, 14 May 2010 02:36:47 +0000 (+0200) Subject: util: flush inotify fd only when we have it X-Git-Tag: v1~399 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=e3d1855bb991f7b118b77e6a2520eb4049cf5438 util: flush inotify fd only when we have it --- diff --git a/util.c b/util.c index f5f1b3a45..f8b3f44ad 100644 --- a/util.c +++ b/util.c @@ -1627,8 +1627,9 @@ int acquire_terminal(const char *name, bool fail, bool force) { } for (;;) { - if ((r = flush_fd(notify)) < 0) - goto fail; + if (notify >= 0) + if ((r = flush_fd(notify)) < 0) + goto fail; /* We pass here O_NOCTTY only so that we can check the return * value TIOCSCTTY and have a reliable way to figure out if we