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

#include <assert.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>

int main(int argc, char **argv) {
  int fd = socket(AF_INET, SOCK_DGRAM, 0);

  unsigned int z;
  int res = ioctl(fd, FIOGETOWN, &z);
  assert(res == 0);
  close(fd);
  if (z)
    exit(0);
  return 0;
}