about summary refs log tree commit diff
path: root/src/libwpactrl/wpactrl_querysa.c
blob: fe0620213605313490359c4588d905eb62a13d99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <errno.h>
#include <skalibs/stralloc.h>
#include <bcnm/wpactrl.h>
#include "wpactrl-internal.h"

int wpactrl_querysa (wpactrl_t *a, char const *s, size_t len, stralloc *sa, tain_t const *deadline, tain_t *stamp)
{
  char buf[WPACTRL_PACKET_MAX] ;
  ssize_t r = wpactrl_query(a, s, len, buf, WPACTRL_PACKET_MAX, deadline, stamp) ;
  if (r < 0) return 0 ;
  if (!r) return (errno = EPIPE, 0) ;
  return stralloc_catb(sa, buf, r) ;
}