revert the non modeline third_party changes

This commit is contained in:
Jōshin 2023-12-16 22:53:52 -05:00
parent db38547c6c
commit 66f368b87f
No known key found for this signature in database
3 changed files with 47 additions and 47 deletions

View file

@ -47,7 +47,7 @@ static unsigned atou(char **s) {
} }
int __getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, int __getgrent_a(FILE *f, struct group *gr, char **line, size_t *size,
char ***mem, size_t *nmem, struct group **res) { char ***mem, size_t *nmem, struct group **res) {
ssize_t l; ssize_t l;
char *s, *mems; char *s, *mems;
size_t i; size_t i;
@ -104,8 +104,8 @@ end:
} }
int __getgr_a(const char *name, gid_t gid, struct group *gr, char **buf, int __getgr_a(const char *name, gid_t gid, struct group *gr, char **buf,
size_t *size, char ***mem, size_t *nmem, size_t *size, char ***mem, size_t *nmem,
struct group **res) { struct group **res) {
FILE *f; FILE *f;
int rv = 0; int rv = 0;
int cs; int cs;

View file

@ -53,7 +53,7 @@ static void cleanup(void *p)
struct pollfd *pfd = p; struct pollfd *pfd = p;
for (int i=0; pfd[i].fd >= -1; i++) for (int i=0; pfd[i].fd >= -1; i++)
if (pfd[i].fd >= 0) if (pfd[i].fd >= 0)
close(pfd[i].fd); close(pfd[i].fd);
} }
static unsigned long mtime() static unsigned long mtime()
@ -299,51 +299,51 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
} }
for (i=0; i<nqueries; i++) { for (i=0; i<nqueries; i++) {
if (pfd[i].revents & POLLOUT) { if (pfd[i].revents & POLLOUT) {
struct msghdr mh = { struct msghdr mh = {
.msg_iovlen = 2, .msg_iovlen = 2,
.msg_iov = (struct iovec [2]){ .msg_iov = (struct iovec [2]){
{ .iov_base = (uint8_t[]){ qlens[i]>>8, qlens[i] }, .iov_len = 2 }, { .iov_base = (uint8_t[]){ qlens[i]>>8, qlens[i] }, .iov_len = 2 },
{ .iov_base = (void *)queries[i], .iov_len = qlens[i] } } { .iov_base = (void *)queries[i], .iov_len = qlens[i] } }
}; };
step_mh(&mh, qpos[i]); step_mh(&mh, qpos[i]);
r = sendmsg(pfd[i].fd, &mh, MSG_NOSIGNAL); r = sendmsg(pfd[i].fd, &mh, MSG_NOSIGNAL);
if (r < 0) goto out; if (r < 0) goto out;
qpos[i] += r; qpos[i] += r;
if (qpos[i] == qlens[i]+2) if (qpos[i] == qlens[i]+2)
pfd[i].events = POLLIN; pfd[i].events = POLLIN;
} }
} }
for (i=0; i<nqueries; i++) { for (i=0; i<nqueries; i++) {
if (pfd[i].revents & POLLIN) { if (pfd[i].revents & POLLIN) {
struct msghdr mh = { struct msghdr mh = {
.msg_iovlen = 2, .msg_iovlen = 2,
.msg_iov = (struct iovec [2]){ .msg_iov = (struct iovec [2]){
{ .iov_base = alen_buf[i], .iov_len = 2 }, { .iov_base = alen_buf[i], .iov_len = 2 },
{ .iov_base = answers[i], .iov_len = asize } } { .iov_base = answers[i], .iov_len = asize } }
}; };
step_mh(&mh, apos[i]); step_mh(&mh, apos[i]);
r = recvmsg(pfd[i].fd, &mh, 0); r = recvmsg(pfd[i].fd, &mh, 0);
if (r <= 0) goto out; if (r <= 0) goto out;
apos[i] += r; apos[i] += r;
if (apos[i] < 2) continue; if (apos[i] < 2) continue;
int alen = alen_buf[i][0]*256 + alen_buf[i][1]; int alen = alen_buf[i][0]*256 + alen_buf[i][1];
if (alen < 13) goto out; if (alen < 13) goto out;
if (apos[i] < alen+2 && apos[i] < asize+2) if (apos[i] < alen+2 && apos[i] < asize+2)
continue; continue;
int rcode = answers[i][3] & 15; int rcode = answers[i][3] & 15;
if (rcode != 0 && rcode != 3) if (rcode != 0 && rcode != 3)
goto out; goto out;
/* Storing the length here commits the accepted answer. /* Storing the length here commits the accepted answer.
* Immediately close TCP socket so as not to consume * Immediately close TCP socket so as not to consume
* resources we no longer need. */ * resources we no longer need. */
alens[i] = alen; alens[i] = alen;
close(pfd[i].fd); close(pfd[i].fd);
pfd[i].fd = -1; pfd[i].fd = -1;
} }
} }
} }
out: out:
pthread_cleanup_pop(1); pthread_cleanup_pop(1);

View file

@ -128,7 +128,7 @@ int __get_resolv_conf(struct resolvconf *conf, char *search, size_t search_sz)
} else { } else {
return -1; return -1;
} }
} }
while (fgets(line, sizeof line, f)) { while (fgets(line, sizeof line, f)) {
char *p, *z; char *p, *z;