view compiler-rt/test/msan/getutent.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
line wrap: on
line source

// 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();
}