Hi!
Could someone please explain why the following code snippet
does not work anymore with the "/dev/console" argument?
# ./tiocsctty /dev/console
tiocsctty: ioctl(/dev/console, TIOCSCTTY): Operation not permitted
Thanks,
--
Ruslan Ermilov Oracle Developer/DBA,
[EMAIL PROTECTED] Sunbay Software AG,
[EMAIL PROTECTED] FreeBSD committer,
+380.652.512.251 Simferopol, Ukraine
http://www.FreeBSD.org The Power To Serve
http://www.oracle.com Enabling The Information Age
#include <sys/ioctl.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[])
{
int fd;
if (argc != 2)
errx(1, "missing argument");
if ((fd = open(argv[1], O_RDWR)) == -1)
err(1, "open %s", argv[1]);
if (daemon(1, 1) == -1)
err(1, "daemon");
if (ioctl(fd, TIOCSCTTY) == -1)
err(1, "ioctl(%s, TIOCSCTTY)", argv[1]);
exit(0);
}