File: chroot.c

package info (click to toggle)
libpulp 0.3.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,976 kB
  • sloc: ansic: 11,792; python: 1,216; sh: 881; makefile: 871; cpp: 582; asm: 387
file content (34 lines) | stat: -rw-r--r-- 646 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

#include "libparameters.h"

int
main(void)
{
  char buffer[128];

  if (chroot("/proc")) {
    /* Permission error, skip the test.  */
    printf("chroot error\n");
    return 77;
  }

  /* Loop waiting for any input. */
  printf("Waiting for input.\n");
  while (1) {
    if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
      if (errno) {
        perror("chroot");
        return 1;
      }
      printf("Reached the end of file; quitting.\n");
      return 0;
    }
    int_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    float_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
  }

  return 1;
}