version 1.18, 2019/05/16 06:23:15 |
version 1.19, 2019/06/28 13:35:05 |
|
|
* open will fail on slip lines or exclusive-use lines |
* open will fail on slip lines or exclusive-use lines |
* if not running as root; not an error. |
* if not running as root; not an error. |
*/ |
*/ |
if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) < 0) { |
if ((fd = open(device, O_WRONLY|O_NONBLOCK, 0)) == -1) { |
if (errno == EBUSY || errno == EACCES) |
if (errno == EBUSY || errno == EACCES) |
return (NULL); |
return (NULL); |
(void) snprintf(errbuf, sizeof(errbuf), |
(void) snprintf(errbuf, sizeof(errbuf), |
|
|
} |
} |
|
|
if (getuid()) { |
if (getuid()) { |
if (fstat(fd, &st) < 0 || |
if (fstat(fd, &st) == -1 || |
(st.st_mode & S_IWGRP) == 0) { |
(st.st_mode & S_IWGRP) == 0) { |
close(fd); |
close(fd); |
return (NULL); |
return (NULL); |
|
|
_exit(1); |
_exit(1); |
} |
} |
cpid = fork(); |
cpid = fork(); |
if (cpid < 0) { |
if (cpid == -1) { |
(void) snprintf(errbuf, sizeof(errbuf), |
(void) snprintf(errbuf, sizeof(errbuf), |
"fork: %s", strerror(errno)); |
"fork: %s", strerror(errno)); |
(void) close(fd); |
(void) close(fd); |