[BACK]Return to main.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/main.c between version 1.264 and 1.265

version 1.264, 2016/04/13 12:26:25 version 1.265, 2016/04/14 20:55:48
Line 35 
Line 35 
 #include <stdint.h>  #include <stdint.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <time.h>
 #include <unistd.h>  #include <unistd.h>
   
 #include "mandoc_aux.h"  #include "mandoc_aux.h"
Line 1020  mmsg(enum mandocerr t, enum mandoclevel lvl,
Line 1021  mmsg(enum mandocerr t, enum mandoclevel lvl,
 static pid_t  static pid_t
 spawn_pager(struct tag_files *tag_files)  spawn_pager(struct tag_files *tag_files)
 {  {
           const struct timespec timeout = { 0, 100000000 };  /* 0.1s */
 #define MAX_PAGER_ARGS 16  #define MAX_PAGER_ARGS 16
         char            *argv[MAX_PAGER_ARGS];          char            *argv[MAX_PAGER_ARGS];
         const char      *pager;          const char      *pager;
Line 1069  spawn_pager(struct tag_files *tag_files)
Line 1071  spawn_pager(struct tag_files *tag_files)
         case -1:          case -1:
                 err((int)MANDOCLEVEL_SYSERR, "fork");                  err((int)MANDOCLEVEL_SYSERR, "fork");
         case 0:          case 0:
                 /* Set pgrp in both parent and child to avoid racing exec. */  
                 (void)setpgid(0, 0);  
                 break;                  break;
         default:          default:
                 (void)setpgid(pager_pid, 0);                  (void)setpgid(pager_pid, 0);
Line 1089  spawn_pager(struct tag_files *tag_files)
Line 1089  spawn_pager(struct tag_files *tag_files)
                 err((int)MANDOCLEVEL_SYSERR, "pager stdout");                  err((int)MANDOCLEVEL_SYSERR, "pager stdout");
         close(tag_files->ofd);          close(tag_files->ofd);
         close(tag_files->tfd);          close(tag_files->tfd);
   
           /* Do not start the pager before controlling the terminal. */
   
           while (tcgetpgrp(STDIN_FILENO) != getpid())
                   nanosleep(&timeout, NULL);
   
         execvp(argv[0], argv);          execvp(argv[0], argv);
         err((int)MANDOCLEVEL_SYSERR, "exec %s", argv[0]);          err((int)MANDOCLEVEL_SYSERR, "exec %s", argv[0]);
 }  }

Legend:
Removed from v.1.264  
changed lines
  Added in v.1.265

CVSweb