Fossil SCM

Call fossil_fatal() when fossil_fopen fail on commit_warning(). This fix SIGSEGV when converting CR/NL where files are read-only. (reported on ML)

mgagnon 2014-04-02 03:30 trunk
Commit c3d09540dd26883665bf856a6581b76a012034a7
1 file changed +3
--- src/checkin.c
+++ src/checkin.c
@@ -1301,10 +1301,13 @@
13011301
char *zOrig = file_newname(zFilename, "original", 1);
13021302
FILE *f;
13031303
blob_write_to_file(p, zOrig);
13041304
fossil_free(zOrig);
13051305
f = fossil_fopen(zFilename, "wb");
1306
+ if( f==0 ){
1307
+ fossil_fatal("cannot open %s for writing", zFilename);
1308
+ }
13061309
if( fUnicode ) {
13071310
int bomSize;
13081311
const unsigned char *bom = get_utf8_bom(&bomSize);
13091312
fwrite(bom, 1, bomSize, f);
13101313
blob_to_utf8_no_bom(p, 0);
13111314
--- src/checkin.c
+++ src/checkin.c
@@ -1301,10 +1301,13 @@
1301 char *zOrig = file_newname(zFilename, "original", 1);
1302 FILE *f;
1303 blob_write_to_file(p, zOrig);
1304 fossil_free(zOrig);
1305 f = fossil_fopen(zFilename, "wb");
 
 
 
1306 if( fUnicode ) {
1307 int bomSize;
1308 const unsigned char *bom = get_utf8_bom(&bomSize);
1309 fwrite(bom, 1, bomSize, f);
1310 blob_to_utf8_no_bom(p, 0);
1311
--- src/checkin.c
+++ src/checkin.c
@@ -1301,10 +1301,13 @@
1301 char *zOrig = file_newname(zFilename, "original", 1);
1302 FILE *f;
1303 blob_write_to_file(p, zOrig);
1304 fossil_free(zOrig);
1305 f = fossil_fopen(zFilename, "wb");
1306 if( f==0 ){
1307 fossil_fatal("cannot open %s for writing", zFilename);
1308 }
1309 if( fUnicode ) {
1310 int bomSize;
1311 const unsigned char *bom = get_utf8_bom(&bomSize);
1312 fwrite(bom, 1, bomSize, f);
1313 blob_to_utf8_no_bom(p, 0);
1314

Keyboard Shortcuts

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