]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/sanitizer_common/TestCases/Linux/getpass.cc
1 // RUN: %clangxx -O0 -g %s -lutil -o %t && %run %t | FileCheck %s
2 // REQUIRES: stable-runtime
10 main (int argc
, char** argv
)
13 int pid
= forkpty(&master
, NULL
, NULL
, NULL
);
16 fprintf(stderr
, "forkpty failed\n");
20 int res
= read(master
, buf
, sizeof(buf
));
22 write(master
, "password\n", 9);
23 while ((res
= read(master
, buf
, sizeof(buf
))) > 0) write(1, buf
, res
);
25 char *s
= getpass("prompt");
26 assert(strcmp(s
, "password") == 0);
27 write(1, "done\n", 5);