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 Unified Diffs Show Whitespace Changes Patch

Changes to src/checkin.c.

470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
  int showHdr = command==CHANGES && find_option("header", 0, 0);
  int verboseFlag = command==CHANGES && find_option("verbose", "v", 0);
  const char *zIgnoreFlag = find_option("ignore", 0, 1);
  unsigned scanFlags = 0;
  unsigned flags = 0;
  int vid, i;

  fossil_pledge("stdio rpath wpath cpath id flock tty", "");

  /* Load affirmative flag options. */
  for( i=0; i<count(flagDefs); ++i ){
    if( (command==CHANGES || !(flagDefs[i].mask & C_CLASSIFY))
     && find_option(flagDefs[i].option, 0, 0) ){
      flags |= flagDefs[i].mask;
    }







|







470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
  int showHdr = command==CHANGES && find_option("header", 0, 0);
  int verboseFlag = command==CHANGES && find_option("verbose", "v", 0);
  const char *zIgnoreFlag = find_option("ignore", 0, 1);
  unsigned scanFlags = 0;
  unsigned flags = 0;
  int vid, i;

  fossil_pledge("stdio rpath wpath cpath id flock tty");

  /* Load affirmative flag options. */
  for( i=0; i<count(flagDefs); ++i ){
    if( (command==CHANGES || !(flagDefs[i].mask & C_CLASSIFY))
     && find_option(flagDefs[i].option, 0, 0) ){
      flags |= flagDefs[i].mask;
    }

Changes to src/config.h.

258
259
260
261
262
263
264
265
266
267
268
269

/*
** The pledge() interface is currently only available on OpenBSD 5.9
** and later.  Make calls to fossil_pledge() no-ops on all platforms
** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
*/
#if !defined(HAVE_PLEDGE)
# define fossil_pledge(A,B)
#endif


#endif /* _RC_COMPILE_ */







|




258
259
260
261
262
263
264
265
266
267
268
269

/*
** The pledge() interface is currently only available on OpenBSD 5.9
** and later.  Make calls to fossil_pledge() no-ops on all platforms
** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
*/
#if !defined(HAVE_PLEDGE)
# define fossil_pledge(A)
#endif


#endif /* _RC_COMPILE_ */

Changes to src/util.c.

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







|
|
|
|



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