diff --git a/sk.c b/sk.c index 84cf11e..b006c57 100644 --- a/sk.c +++ b/sk.c @@ -119,7 +119,7 @@ int sk_interface_phc(char *name, int *index) close(fd); *index = info.phc_index; - return 0; + return info.phc_index < 0 ? -1 : 0; #else return -1; #endif diff --git a/sk.h b/sk.h index 5f1ee4b..b2787b2 100644 --- a/sk.h +++ b/sk.h @@ -33,7 +33,8 @@ int sk_interface_index(int fd, char *device); /** * Obtain the PHC device index of a network interface. * @param name The name of the interface - * @return index The phc index associated with this iface + * @return index The non-negative phc index associated with this iface. + * On error a negative integer is returned. */ int sk_interface_phc(char *name, int *index);