dect
/
libpcap
Archived
1
0
Fork 0

Treat either EPERM or EACCES as "no soup for you".

master
Guy Harris 12 years ago
parent 74b7b4259f
commit 4d7214cbc5
  1. 7
      pcap-dlpi.c
  2. 6
      pcap-libdlpi.c

@ -449,7 +449,7 @@ pcap_activate_dlpi(pcap_t *p)
/* Try device without unit number */
if ((p->fd = open(dname, O_RDWR)) < 0) {
if (errno != ENOENT) {
if (errno == EACCES)
if (errno == EPERM || errno == EACCES)
status = PCAP_ERROR_PERM_DENIED;
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s", dname,
pcap_strerror(errno));
@ -485,7 +485,7 @@ pcap_activate_dlpi(pcap_t *p)
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"%s: No DLPI device found", p->opt.source);
} else {
if (errno == EACCES)
if (errno == EPERM || errno == EACCES)
status = PCAP_ERROR_PERM_DENIED;
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
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,
"recv_ack: %s: UNIX error - %s",
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);
break;

@ -115,7 +115,8 @@ pcap_activate_libdlpi(pcap_t *p)
if (retv != DLPI_SUCCESS) {
if (retv == DLPI_ELINKNAMEINVAL || retv == DLPI_ENOLINK)
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;
pcap_libdlpi_err(p->opt.source, "dlpi_open", retv,
p->errbuf);
@ -238,7 +239,8 @@ dlpromiscon(pcap_t *p, bpf_u_int32 level)
retv = dlpi_promiscon(p->hd, level);
if (retv != DLPI_SUCCESS) {
if (retv == DL_SYSERR && errno == EACCES)
if (retv == DL_SYSERR &&
(errno == EPERM || errno == EACCES))
err = PCAP_ERROR_PERM_DENIED;
else
err = PCAP_ERROR;