I'm not an fattach specialist, so maybe someone else can answer this.
-- Dave

Subject: fattach failed on application without super user privilege
To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Date: Thu, 25 Sep 2003 09:59:18 -0400


Hi, I have an application running with LiS-2.16/Linux 2.4.18. The application create named pipe, and push connld, and attach it (the program showed in belows). It always failed on the calling fattach fucntion if the application does not have super-user privilege. I tried fattach utility and got the same result ("Operation is not permitted"). If the application run on the super user mode, it succeeded. I need my application run on non-super user mode, how can I do it ? Thanks


#include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <memory.h> #include <fcntl.h> #include <errno.h> #include <limits.h> #include <stropts.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/sysmacros.h> #include <sys/ioctl.h>


int main( int argc, char *argv[] ) { int fd[2];

      if (pipe(fd) < 0)  {
            fprintf( stderr,
                  "pipe() failed: %s\n", strerror(errno) );
            exit(1);
      }
      fcntl(fd[1], F_SETFL, O_NONBLOCK);
      mknod("pipe1", S_IFIFO | 0666, 0);

      if (ioctl( fd[1], I_PUSH, "connld" ) < 0) {
            fprintf( stderr,
                  "ioctl( %d, I_PUSH, connld ) failed: %s\n",
                  fd[1], strerror(errno) );
            exit(1);
      }

      if (fattach( fd[1], "pipe1" ) < 0) {
            fprintf( stderr, "fattach( %d, \"pipe1\" ) failed: %d %s\n",
                  fd[1], errno, strerror(errno) );
            exit(1);
      }

      close(fd[0]);
      close(fd[1]);

      exit(0);
}



Frank Chi
Senior Programming Engineer
Ingenico Atlanta
(678) 795-2850 Direct
(770) 594-6003 Fax


_______________________________________________
Linux-streams mailing list
[EMAIL PROTECTED]
http://gsyc.escet.urjc.es/mailman/listinfo/linux-streams

Reply via email to