"Fossies" - the Fresh Open Source Software Archive

Member "reptyr-reptyr-0.8.0/test/victim.c" (29 Sep 2020, 554 Bytes) of package /linux/privat/reptyr-reptyr-0.8.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "victim.c": 0.7.0_vs_0.8.0.

    1 #include <stdio.h>
    2 
    3 #ifdef __linux__
    4 #include <sys/prctl.h>
    5 
    6 #ifndef PR_SET_PTRACER
    7 #define PR_SET_PTRACER
    8 #endif
    9 
   10 #ifndef PR_SET_PTRACER_ANY
   11 # define PR_SET_PTRACER_ANY ((unsigned long)-1)
   12 #endif
   13 #endif
   14 
   15 int main(int argc, char **argv) {
   16     char *line = NULL;
   17     size_t cap = 0;
   18 
   19 #ifdef __linux__
   20     int err = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY);
   21     if (err != 0) {
   22         fprintf(stderr, "Unable to PR_SET_PTRACER: %m\n");
   23     }
   24 #endif
   25 
   26     while(getline(&line, &cap, stdin) != -1) {
   27         printf("ECHO: %s", line);
   28     }
   29 
   30     return 0;
   31 }