]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-dag.c
Update config.{guess,sub}, timestamps 2023-01-01,2023-01-21
[libpcap] / pcap-dag.c
index 3199a70fdf464f8c3ae28333bee6c0d7cc4e306a..f261ead00df8a0c3bdcbe47206d03b180b883f94 100644 (file)
@@ -736,7 +736,7 @@ dag_inject(pcap_t *p, const void *buf _U_, int size _U_)
  *  API polling parameters.
  *
  *  snaplen is now also ignored, until we get per-stream slen support. Set
- *  slen with approprite DAG tool BEFORE pcap_activate().
+ *  slen with appropriate DAG tool BEFORE pcap_activate().
  *
  *  See also pcap(3).
  */
@@ -793,9 +793,14 @@ static int dag_activate(pcap_t* p)
                /*
                 * XXX - does this reliably set errno?
                 */
-               if (errno == ENOENT)
+               if (errno == ENOENT) {
+                       /*
+                        * There's nothing more to say, so clear
+                        * the error message.
+                        */
                        ret = PCAP_ERROR_NO_SUCH_DEVICE;
-               else if (errno == EPERM || errno == EACCES) {
+                       p->errbuf[0] = '\0';
+               } else if (errno == EPERM || errno == EACCES) {
                        ret = PCAP_ERROR_PERM_DENIED;
                        snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "Attempt to open %s failed with %s - additional privileges may be required",