[Git][NTPsec/ntpsec][master] Use getaddrinfo() instead of making assumptions about NSS configuration
Matt Selsky
gitlab at mg.gitlab.com
Sat Jan 26 17:12:44 UTC 2019
Matt Selsky pushed to branch master at NTPsec / ntpsec
Commits:
d0e472dc by Matt Selsky at 2019-01-26T17:07:33Z
Use getaddrinfo() instead of making assumptions about NSS configuration
GitLab issue #477
- - - - -
1 changed file:
- tests/libntp/decodenetnum.c
Changes:
=====================================
tests/libntp/decodenetnum.c
=====================================
@@ -1,7 +1,5 @@
-#include <unistd.h> /* for close() */
#include <sys/types.h>
#include <sys/stat.h>
-#include <fcntl.h>
#include "config.h"
#include "ntp_stdlib.h"
@@ -19,15 +17,14 @@ TEST_TEAR_DOWN(decodenetnum) {}
TEST(decodenetnum, Services) {
- const char *str = "/etc/services";
- int ret;
-
- /* try to open /etc/services for read */
- ret = open(str, O_RDONLY);
- TEST_ASSERT_NOT_EQUAL(-1, ret);
- if ( -1 != ret) {
- close(ret);
- }
+ struct addrinfo *res;
+ int ret;
+
+ ret = getaddrinfo(NULL, "ntp", NULL, &res);
+ TEST_ASSERT_EQUAL_MESSAGE(0, ret, gai_strerror(ret));
+ if (0 == ret) {
+ freeaddrinfo(res);
+ }
}
TEST(decodenetnum, IPv4AddressOnly) {
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d0e472dc9e6538be91162cd41bb41e23295356d2
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d0e472dc9e6538be91162cd41bb41e23295356d2
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190126/ca8d1a2b/attachment-0001.html>
More information about the vc
mailing list