aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2010-09-21 02:46:53 -0700
committerGuy Harris <guy@alum.mit.edu>2010-09-21 02:46:53 -0700
commit4d7214cbc5dcc8e9635f99c13367dea37eddda0f (patch)
treeb90d8bc31a6fb418b72caaeaa1ad1a9b37366c6b
parent74b7b4259fde15dbb07cde3a5920e9f7e0ed4484 (diff)
Treat either EPERM or EACCES as "no soup for you".
-rw-r--r--pcap-dlpi.c7
-rw-r--r--pcap-libdlpi.c6
2 files changed, 8 insertions, 5 deletions
diff --git a/pcap-dlpi.c b/pcap-dlpi.c
index ec2f32d..f7eb507 100644
--- a/pcap-dlpi.c
+++ b/pcap-dlpi.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;
diff --git a/pcap-libdlpi.c b/pcap-libdlpi.c
index 56dadc4..8d6a038 100644
--- a/pcap-libdlpi.c
+++ b/pcap-libdlpi.c
@@ -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;