summaryrefslogtreecommitdiff
path: root/test/msan/getutent.cpp
blob: b57101068dddfa9b5941ed3e8211f82c2a286f47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t

#ifndef __FreeBSD__
#include <utmp.h>
#endif
#include <utmpx.h>
#include <sanitizer/msan_interface.h>

int main(void) {
#ifndef __FreeBSD__
  setutent();
  while (struct utmp *ut = getutent())
    __msan_check_mem_is_initialized(ut, sizeof(*ut));
  endutent();
#endif

  setutxent();
  while (struct utmpx *utx = getutxent())
    __msan_check_mem_is_initialized(utx, sizeof(*utx));
  endutxent();
}