From rhh@ct.picker.com  Sun Dec 14 16:25:51 1997
Received: from whqvax.picker.com (whqvax.picker.com [144.54.1.1])
          by hub.freebsd.org (8.8.7/8.8.7) with SMTP id QAA26306
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Dec 1997 16:25:50 -0800 (PST)
          (envelope-from rhh@ct.picker.com)
Received: from ct.picker.com by whqvax.picker.com with SMTP;
          Sun, 14 Dec 1997 19:25:19 -0500 (EST)
Received: from stealth.ct.picker.com (eagle.ct.picker.com) by ct.picker.com (4.1/SMI-4.1)
	id AA02543; Sun, 14 Dec 97 19:25:16 EST
Received: (from rhh@localhost)
	by stealth.ct.picker.com (8.8.8/8.8.8) id TAA16235;
	Sun, 14 Dec 1997 19:26:16 GMT
	(envelope-from rhh)
Message-Id: <199712141926.TAA16235@stealth.ct.picker.com>
Date: Sun, 14 Dec 1997 19:26:16 GMT
From: rhh@ct.picker.com
Reply-To: rhh@ct.picker.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: rhh@ct.picker.com
Subject: slattach fails creating pidfile with ioctl(TIOCSCTTY): Operation not permitted
X-Send-Pr-Version: 3.2

>Number:         5296
>Category:       bin
>Synopsis:       slattach fails creating pidfile with ioctl(TIOCSCTTY): Operation not permitted
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 14 16:30:01 PST 1997
>Closed-Date:    Fri Feb 15 14:54:44 UTC 2013
>Last-Modified:  Fri Feb 15 14:54:44 UTC 2013
>Originator:     Randall Hopper
>Release:        FreeBSD 3.0-971208-SNAP i386
>Organization:
self
>Environment:

	Straight 3.0-971208 installation with stock slattach.

>Description:

	If I run my SLIP script (which invokes slattach) from inside an
	xterm, it works fine (doesn't log errors in /var/log/messages, 
	and does correctly create the var/run/slattach.cuaa1.pid pidfile.

	However, if I run my SLIP script from my window manager menus
	(i.e. not inside a vtty), then slattach logs the following error
        in /var/log/messages:

             slattach[15882]: ioctl(TIOCSCTTY): Operation not permitted

        and does not create a /var/run pidfile.

	3.0-current slattach otherwise appears to work; it just doesn't 
	create the pidfile that I use in other scripts & cron jobs.
 
>How-To-Repeat:

	Here is a clip from my "slip-on" script that shows how I invoke
        slattach (error checking removed for simplicity):

             #!/bin/sh
	     ...
	     exec 0< /dev/cuaa1
	     exec 1> /dev/cuaa1
	     chat TIMEOUT 2 "" AT OK AT OK
             chat "" "$INITSTRING" "OK" "AT$DIALSTRING" ...<request slip cmds>
             slattach -h -c -s 57600 /dev/cuaa1 > /dev/null 2>&1 &


>Fix:
	
	Not known.

>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@FreeBSD.ORG, rhh@ct.picker.com
Cc:  Subject: Re: bin/5296: slattach fails creating pidfile with ioctl(TIOCSCTTY): Operation not permitted
Date: Tue, 16 Dec 1997 00:20:50 +1100

 >>How-To-Repeat:
 >
 >	Here is a clip from my "slip-on" script that shows how I invoke
 >        slattach (error checking removed for simplicity):
 >
 >             #!/bin/sh
 >	     ...
 >	     exec 0< /dev/cuaa1
 >	     exec 1> /dev/cuaa1
 >	     chat TIMEOUT 2 "" AT OK AT OK
 >             chat "" "$INITSTRING" "OK" "AT$DIALSTRING" ...<request slip cmds>
 >             slattach -h -c -s 57600 /dev/cuaa1 > /dev/null 2>&1 &
 
 slattach can't do controlling tty stuff properly if the tty is already
 open.  It should fail completely when the TIOCSCTTY fails, but its
 cleanup is incomplete - it removes the pid file but doesn't unattach
 slip :-).
 
 Chatting with the tty has to be done by calling chat from inside slattach
 (-z -r ...).  Support for an initial command without a redial command
 seems to be missing.  I think aborting on SIGHUP when there is no redial
 command has been broken for a long time.  Scripts probably expect this
 brokenness.
 
 Bruce
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Thu Apr 30 12:55:02 PDT 1998 
State-Changed-Why:  
bruce spoke. 
State-Changed-From-To: closed->suspended 
State-Changed-By: phk 
State-Changed-When: Sun May 3 14:48:45 PDT 1998 
State-Changed-Why:  
put this in suspended, appearantly people don't expect SLIP to die as fast as I do... 

From: "KAREN THODE" <thode12@msn.com>
To: <freebsd-gnats-submit@freebsd.org>
Cc:  
Subject: bin/5296
Date: Thu, 22 May 2003 07:05:43 -0500

 ------=_NextPart_001_0000_01C32030.8F63FE80
 Content-Type: text/plain; charset="iso-8859-1"
 
 Here is another way to create the pidfile (or any file, for that matter):
 
 int create(char *path)
 {
      int fd;
      
      if((fd=open(path, CREATE|EXCL|WRONLY, READ|WRITE)) == -1)
      {
           return(0);
      }
      close(fd);
      return(1);
 }
 
 Note that create() returns a 1 on success and a 0 on failure.
 
 Lucas
 ------=_NextPart_001_0000_01C32030.8F63FE80
 Content-Type: text/html; charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 
 <HTML><BODY STYLE=3D"font:10pt verdana; border:none;"><DIV>Here is anothe=
 r way to create the pidfile (or any file, for that matter):</DIV> <DIV>&n=
 bsp;</DIV> <DIV>int&nbsp;create(char *path)</DIV> <DIV>{</DIV> <DIV>&nbsp=
 ;&nbsp;&nbsp;&nbsp; int fd;</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; </DIV> <D=
 IV>&nbsp;&nbsp;&nbsp;&nbsp; if((fd=3Dopen(path, CREATE|EXCL|WRONLY, READ|=
 WRITE)) =3D=3D -1)</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; {</DIV> <DIV>&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return(0);</DIV> <DIV>&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; close(=
 fd);</DIV> <DIV>&nbsp;&nbsp;&nbsp;&nbsp; return(1);</DIV> <DIV>}</DIV> <D=
 IV>&nbsp;</DIV> <DIV>Note that create() returns a 1 on success and a 0 on=
  failure.</DIV> <DIV>&nbsp;</DIV> <DIV>Lucas<BR><BR></DIV></BODY></HTML>
 
 ------=_NextPart_001_0000_01C32030.8F63FE80--
State-Changed-From-To: suspended->closed 
State-Changed-By: emaste 
State-Changed-When: Fri Feb 15 14:53:47 UTC 2013 
State-Changed-Why:  
Time to move on; SLIP is long gone. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=5296 
>Unformatted:
