Treat either EPERM or EACCES as "no soup for you".
This commit is contained in:
parent
74b7b4259f
commit
4d7214cbc5
|
@ -449,7 +449,7 @@ pcap_activate_dlpi(pcap_t *p)
|
||||||
/* Try device without unit number */
|
/* Try device without unit number */
|
||||||
if ((p->fd = open(dname, O_RDWR)) < 0) {
|
if ((p->fd = open(dname, O_RDWR)) < 0) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
if (errno == EACCES)
|
if (errno == EPERM || errno == EACCES)
|
||||||
status = PCAP_ERROR_PERM_DENIED;
|
status = PCAP_ERROR_PERM_DENIED;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname,
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname,
|
||||||
pcap_strerror(errno));
|
pcap_strerror(errno));
|
||||||
|
@ -485,7 +485,7 @@ pcap_activate_dlpi(pcap_t *p)
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
|
||||||
"%s: No DLPI device found", p->opt.source);
|
"%s: No DLPI device found", p->opt.source);
|
||||||
} else {
|
} else {
|
||||||
if (errno == EACCES)
|
if (errno == EPERM || errno == EACCES)
|
||||||
status = PCAP_ERROR_PERM_DENIED;
|
status = PCAP_ERROR_PERM_DENIED;
|
||||||
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
|
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
|
||||||
dname2, pcap_strerror(errno));
|
dname2, pcap_strerror(errno));
|
||||||
|
@ -1018,7 +1018,8 @@ recv_ack(int fd, int size, const char *what, char *bufp, char *ebuf, int *uerror
|
||||||
snprintf(ebuf, PCAP_ERRBUF_SIZE,
|
snprintf(ebuf, PCAP_ERRBUF_SIZE,
|
||||||
"recv_ack: %s: UNIX error - %s",
|
"recv_ack: %s: UNIX error - %s",
|
||||||
what, pcap_strerror(dlp->error_ack.dl_unix_errno));
|
what, pcap_strerror(dlp->error_ack.dl_unix_errno));
|
||||||
if (dlp->error_ack.dl_unix_errno == EACCES)
|
if (dlp->error_ack.dl_unix_errno == EPERM ||
|
||||||
|
dlp->error_ack.dl_unix_errno == EACCES)
|
||||||
return (PCAP_ERROR_PERM_DENIED);
|
return (PCAP_ERROR_PERM_DENIED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,8 @@ pcap_activate_libdlpi(pcap_t *p)
|
||||||
if (retv != DLPI_SUCCESS) {
|
if (retv != DLPI_SUCCESS) {
|
||||||
if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
|
if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
|
||||||
err = PCAP_ERROR_NO_SUCH_DEVICE;
|
err = PCAP_ERROR_NO_SUCH_DEVICE;
|
||||||
else if (retv == DL_SYSERR && errno == EACCES)
|
else if (retv == DL_SYSERR &&
|
||||||
|
(errno == EPERM || errno == EACCES))
|
||||||
err = PCAP_ERROR_PERM_DENIED;
|
err = PCAP_ERROR_PERM_DENIED;
|
||||||
pcap_libdlpi_err(p->opt.source, "dlpi_open", retv,
|
pcap_libdlpi_err(p->opt.source, "dlpi_open", retv,
|
||||||
p->errbuf);
|
p->errbuf);
|
||||||
|
@ -238,7 +239,8 @@ dlpromiscon(pcap_t *p, bpf_u_int32 level)
|
||||||
|
|
||||||
retv = dlpi_promiscon(p->hd, level);
|
retv = dlpi_promiscon(p->hd, level);
|
||||||
if (retv != DLPI_SUCCESS) {
|
if (retv != DLPI_SUCCESS) {
|
||||||
if (retv == DL_SYSERR && errno == EACCES)
|
if (retv == DL_SYSERR &&
|
||||||
|
(errno == EPERM || errno == EACCES))
|
||||||
err = PCAP_ERROR_PERM_DENIED;
|
err = PCAP_ERROR_PERM_DENIED;
|
||||||
else
|
else
|
||||||
err = PCAP_ERROR;
|
err = PCAP_ERROR;
|
||||||
|
|
Reference in New Issue