Fossil

Check-in [91ccde50]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Only make the first argument to pledge() available using the fossil_pledge() interface. The second argument is always NULL.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:91ccde50a003cff52ac9288f22ccb4fd52fc1518dc6c6008a7a7181166f0c8df
User & Date: drh 2018-01-17 19:29:25
Context
2018-01-18
03:52
Now that pledge() is automatically detected, update the comment with the new name of the configuration parameter. check-in: 4f90d591 user: andybradford tags: trunk
2018-01-17
19:29
Only make the first argument to pledge() available using the fossil_pledge() interface. The second argument is always NULL. check-in: 91ccde50 user: drh tags: trunk
19:22
Show the HAVE_PLEDGE configuration parameter in the output of "version -v". check-in: 4471e93c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/checkin.c.

   470    470     int showHdr = command==CHANGES && find_option("header", 0, 0);
   471    471     int verboseFlag = command==CHANGES && find_option("verbose", "v", 0);
   472    472     const char *zIgnoreFlag = find_option("ignore", 0, 1);
   473    473     unsigned scanFlags = 0;
   474    474     unsigned flags = 0;
   475    475     int vid, i;
   476    476   
   477         -  fossil_pledge("stdio rpath wpath cpath id flock tty", "");
          477  +  fossil_pledge("stdio rpath wpath cpath id flock tty");
   478    478   
   479    479     /* Load affirmative flag options. */
   480    480     for( i=0; i<count(flagDefs); ++i ){
   481    481       if( (command==CHANGES || !(flagDefs[i].mask & C_CLASSIFY))
   482    482        && find_option(flagDefs[i].option, 0, 0) ){
   483    483         flags |= flagDefs[i].mask;
   484    484       }

Changes to src/config.h.

   258    258   
   259    259   /*
   260    260   ** The pledge() interface is currently only available on OpenBSD 5.9
   261    261   ** and later.  Make calls to fossil_pledge() no-ops on all platforms
   262    262   ** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
   263    263   */
   264    264   #if !defined(HAVE_PLEDGE)
   265         -# define fossil_pledge(A,B)
          265  +# define fossil_pledge(A)
   266    266   #endif
   267    267   
   268    268   
   269    269   #endif /* _RC_COMPILE_ */

Changes to src/util.c.

   490    490   /*
   491    491   ** Interface to pledge() on OpenBSD 5.9 and later.
   492    492   **
   493    493   ** On platforms that have pledge(), use this routine.
   494    494   ** On all other platforms, this routine does not exist, but instead
   495    495   ** a macro defined in config.h is used to provide a no-op.
   496    496   */
   497         -void fossil_pledge(const char *promises, const char *execpromises){
   498         -  if( pledge(promises, execpromises) ){
   499         -    fossil_fatal("pledge(\"%s\",\"%s\") fails with errno=%d",
   500         -       promises, execpromises, (int)errno);
          497  +void fossil_pledge(const char *promises){
          498  +  if( pledge(promises, 0) ){
          499  +    fossil_fatal("pledge(\"%s\",NULL) fails with errno=%d",
          500  +      promises, (int)errno);
   501    501     }
   502    502   }
   503    503   #endif /* defined(HAVE_PLEDGE) */