Fossil SCM

If running "fossil status" when pledge() is enabled, the "chown" promise needs to be added when running as root, otherwise fossil receive a SIGABRT and crash when attempting to call fchown(...) on creation of the .fossil-journal file.

mgagnon 2018-01-19 18:06 trunk
Commit 396513fa4a6f8da86bbb7508f138b61c876372a5ca8c4e869506ae837bea797e
1 file changed +5 -1
+5 -1
--- src/checkin.c
+++ src/checkin.c
@@ -472,11 +472,15 @@
472472
const char *zIgnoreFlag = find_option("ignore", 0, 1);
473473
unsigned scanFlags = 0;
474474
unsigned flags = 0;
475475
int vid, i;
476476
477
- fossil_pledge("stdio rpath wpath cpath id flock tty");
477
+ if( getuid()==0 ){
478
+ fossil_pledge("stdio rpath wpath cpath id flock tty chown");
479
+ }else{
480
+ fossil_pledge("stdio rpath wpath cpath id flock tty");
481
+ }
478482
479483
/* Load affirmative flag options. */
480484
for( i=0; i<count(flagDefs); ++i ){
481485
if( (command==CHANGES || !(flagDefs[i].mask & C_CLASSIFY))
482486
&& find_option(flagDefs[i].option, 0, 0) ){
483487
--- src/checkin.c
+++ src/checkin.c
@@ -472,11 +472,15 @@
472 const char *zIgnoreFlag = find_option("ignore", 0, 1);
473 unsigned scanFlags = 0;
474 unsigned flags = 0;
475 int vid, i;
476
477 fossil_pledge("stdio rpath wpath cpath id flock tty");
 
 
 
 
478
479 /* Load affirmative flag options. */
480 for( i=0; i<count(flagDefs); ++i ){
481 if( (command==CHANGES || !(flagDefs[i].mask & C_CLASSIFY))
482 && find_option(flagDefs[i].option, 0, 0) ){
483
--- src/checkin.c
+++ src/checkin.c
@@ -472,11 +472,15 @@
472 const char *zIgnoreFlag = find_option("ignore", 0, 1);
473 unsigned scanFlags = 0;
474 unsigned flags = 0;
475 int vid, i;
476
477 if( getuid()==0 ){
478 fossil_pledge("stdio rpath wpath cpath id flock tty chown");
479 }else{
480 fossil_pledge("stdio rpath wpath cpath id flock tty");
481 }
482
483 /* Load affirmative flag options. */
484 for( i=0; i<count(flagDefs); ++i ){
485 if( (command==CHANGES || !(flagDefs[i].mask & C_CLASSIFY))
486 && find_option(flagDefs[i].option, 0, 0) ){
487

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button