On Tue, Sep 17, 2013 at 8:24 PM, Lionel Cons <[email protected]> wrote:
> Can anyone else reproduce the problem that ksh from ast-ksh.20130913
> can hang if I use cd -@ to add an attribute to a FIFO?

Attached (as "astksh20130913_cd_xattr_fifo_nonblock001.diff.txt") is a
patch which fixes the problem by using |O_NONBLOCK| automagically if
we operate on /dev/file/xattr@... ...

Glenn: Is the patch Ok for you ?

---

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
diff -r -u original/src/lib/libast/path/pathcanon.c 
build_xattr/src/lib/libast/path/pathcanon.c
--- src/lib/libast/path/pathcanon.c     2013-09-13 21:01:05.000000000 +0200
+++ src/lib/libast/path/pathcanon.c     2013-09-17 22:55:01.403278472 +0200
@@ -480,9 +480,9 @@
                                                for (r = buf + (t - r); r > buf 
&& *(r - 1) == '/'; r--);
                                                *r = 0;
                                        }
-                                       if ((dev->fd = openat(dfd, buf, 
O_INTERCEPT|O_RDONLY|O_CLOEXEC|dev->oflags)) < 0)
+                                       if ((dev->fd = openat(dfd, buf, 
O_INTERCEPT|O_RDONLY|O_NONBLOCK|O_CLOEXEC|dev->oflags)) < 0)
                                                r = 0;
-                                       else if ((n = openat(dev->fd, ".", 
O_INTERCEPT|O_RDONLY|O_XATTR)) < 0)
+                                       else if ((n = openat(dev->fd, ".", 
O_INTERCEPT|O_RDONLY|O_XATTR|O_NONBLOCK)) < 0)
                                        {
                                                r = 0;
                                                close(dev->fd);
@@ -717,11 +717,11 @@
                                        if (r == canon)
                                                r++;
                                        *r = 0;
-                                       dev->fd = openat(dfd, x, 
O_INTERCEPT|O_RDONLY|O_CLOEXEC|dev->oflags);
+                                       dev->fd = openat(dfd, x, 
O_INTERCEPT|O_RDONLY|O_NONBLOCK|O_CLOEXEC|dev->oflags);
                                        *r = '/';
                                        if (dev->fd < 0)
                                                t = 0;
-                                       else if ((n = openat(dev->fd, ".", 
O_INTERCEPT|O_RDONLY|O_XATTR)) < 0)
+                                       else if ((n = openat(dev->fd, ".", 
O_INTERCEPT|O_RDONLY|O_XATTR|O_NONBLOCK)) < 0)
                                        {
                                                close(dev->fd);
                                                dev->fd = -1;
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to