Fossil

Check-in [7b81a999]
Login

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

Overview
Comment:Add the fossil_pledge() utility routine, that is a no-op unless compiled with FOSSIL_HAVE_PLEDGE.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7b81a9993b4c8192b75940c093bfe7ba3d3c51abd92af750828ea9b7619ae154
User & Date: drh 2018-01-15 16:18:52.971
Context
2018-01-15
17:35
End comment with matching #define for new fossil_pledge_impl() routine---no functional change. ... (check-in: cefcc87e user: andybradford tags: trunk)
16:18
Add the fossil_pledge() utility routine, that is a no-op unless compiled with FOSSIL_HAVE_PLEDGE. ... (check-in: 7b81a999 user: drh tags: trunk)
15:47
Always show the HTTP_IF_NONE_MATCH cgi parameter on the /test_env page. ... (check-in: 39b43686 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/checkin.c.
469
470
471
472
473
474
475


476
477
478
479
480
481
482
  int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
  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;



  /* 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;
    }







>
>







469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
  int useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
  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.
251
252
253
254
255
256
257












258
259
# define NORETURN
#endif

/*
** Number of elements in an array
*/
#define count(X) (sizeof(X)/sizeof(X[0]))













#endif /* _RC_COMPILE_ */







>
>
>
>
>
>
>
>
>
>
>
>


251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# define NORETURN
#endif

/*
** Number of elements in an array
*/
#define count(X) (sizeof(X)/sizeof(X[0]))

/*
** 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(FOSSIL_HAVE_PLEDGE)
# define fossil_pledge(A,B) fossil_pledge_impl(A,B)
#else
# define fossil_pledge(A,B)
#endif


#endif /* _RC_COMPILE_ */
Changes to src/util.c.
481
482
483
484
485
486
487
















  }else{
    x.rlim_cur = origStack;
  }
  setrlimit(RLIMIT_STACK, &x);
#endif /* defined(RLIMIT_STACK) */
#endif /* defined(__unix__) */
}























>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
  }else{
    x.rlim_cur = origStack;
  }
  setrlimit(RLIMIT_STACK, &x);
#endif /* defined(RLIMIT_STACK) */
#endif /* defined(__unix__) */
}

#if defined(FOSSIL_HAVE_PLEDGE)
/*
** Interface to pledge() on OpenBSD 5.9 and later.
**
** There is a macro in config.h that make translates calls to
** "fossil_pledge(A,B)" into calls to this routine on OpenBSD.
** On all other platforms, this routine does not exist.
*/
void fossil_pledge_impl(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(__OpenBSD__) */