summaryrefslogtreecommitdiff
path: root/src/libwpactrl/wpactrl_querysa.c
blob: 887941f73fe5c25ea28ccd373a907e67fcb8d11a (plain)
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 *stamp)
{
  char buf[WPACTRL_PACKET_MAX] ;
  ssize_t r = wpactrl_query(a, s, len, buf, WPACTRL_PACKET_MAX, stamp) ;
  if (r < 0) return 0 ;
  if (!r) return (errno = EPIPE, 0) ;
  return stralloc_catb(sa, buf, r) ;
}