"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/victim.c" between
reptyr-reptyr-0.7.0.tar.gz and reptyr-reptyr-0.8.0.tar.gz

About: reptyr is a utility for taking an existing running program and attaching it to a new terminal.

victim.c  (reptyr-reptyr-0.7.0):victim.c  (reptyr-reptyr-0.8.0)
#include <stdio.h> #include <stdio.h>
#ifdef __linux__
#include <sys/prctl.h> #include <sys/prctl.h>
#ifndef PR_SET_PTRACER #ifndef PR_SET_PTRACER
#define PR_SET_PTRACER #define PR_SET_PTRACER
#endif #endif
#ifndef PR_SET_PTRACER_ANY #ifndef PR_SET_PTRACER_ANY
# define PR_SET_PTRACER_ANY ((unsigned long)-1) # define PR_SET_PTRACER_ANY ((unsigned long)-1)
#endif #endif
#endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
char *line = NULL; char *line = NULL;
size_t cap = 0; size_t cap = 0;
#ifdef __linux__
int err = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); int err = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY);
if (err != 0) { if (err != 0) {
fprintf(stderr, "Unable to PR_SET_PTRACER: %m\n"); fprintf(stderr, "Unable to PR_SET_PTRACER: %m\n");
} }
#endif
while(getline(&line, &cap, stdin) != -1) { while(getline(&line, &cap, stdin) != -1) {
printf("ECHO: %s", line); printf("ECHO: %s", line);
} }
return 0; return 0;
} }
 End of changes. 4 change blocks. 
0 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)