X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.c;h=ffe6624f9a7076142cd0f3ec8290ed7d8b1141af;hb=67608cad2301f9ab5c92336992c176505640f2ba;hp=a8c45239052d53df6f18f869dfe2f2b6397d0804;hpb=03e334a1c7dc8c20c38902aa039440763acc9b17;p=elogind.git diff --git a/src/shared/util.c b/src/shared/util.c index a8c452390..ffe6624f9 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -1500,7 +1500,14 @@ bool fstype_is_network(const char *fstype) { "nfs\0" "nfs4\0" "gfs\0" - "gfs2\0"; + "gfs2\0" + "glusterfs\0"; + + const char *x; + + x = startswith(fstype, "fuse."); + if (x) + fstype = x; return nulstr_contains(table, fstype); } @@ -2037,22 +2044,18 @@ int default_signals(int sig, ...) { return r; } -int close_pipe(int p[]) { - int a = 0, b = 0; - +void safe_close_pair(int p[]) { assert(p); - if (p[0] >= 0) { - a = close_nointr(p[0]); - p[0] = -1; - } - - if (p[1] >= 0) { - b = close_nointr(p[1]); - p[1] = -1; + if (p[0] == p[1]) { + /* Special case pairs which use the same fd in both + * directions... */ + p[0] = p[1] = safe_close(p[0]); + return; } - return a < 0 ? a : b; + p[0] = safe_close(p[0]); + p[1] = safe_close(p[1]); } ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {