Fossil SCM

Fix the file_perm() utility routine so that it actually uses the eFType parameter.

drh 2020-04-30 15:00 trunk
Commit 388b5e59822efeb7b5168676f7f74fd85c2df2b410bc9c8e0083976f1a23c970
3 files changed +1 -1 +1 -1 +1 -1
+1 -1
--- src/file.c
+++ src/file.c
@@ -294,11 +294,11 @@
294294
**
295295
** On windows, this routine returns only PERM_REG.
296296
*/
297297
int file_perm(const char *zFilename, int eFType){
298298
#if !defined(_WIN32)
299
- if( !getStat(zFilename, RepoFILE) ){
299
+ if( !getStat(zFilename, eFType) ){
300300
if( S_ISREG(fx.fileStat.st_mode) && ((S_IXUSR)&fx.fileStat.st_mode)!=0 )
301301
return PERM_EXE;
302302
else if( db_allow_symlinks() && S_ISLNK(fx.fileStat.st_mode) )
303303
return PERM_LNK;
304304
}
305305
--- src/file.c
+++ src/file.c
@@ -294,11 +294,11 @@
294 **
295 ** On windows, this routine returns only PERM_REG.
296 */
297 int file_perm(const char *zFilename, int eFType){
298 #if !defined(_WIN32)
299 if( !getStat(zFilename, RepoFILE) ){
300 if( S_ISREG(fx.fileStat.st_mode) && ((S_IXUSR)&fx.fileStat.st_mode)!=0 )
301 return PERM_EXE;
302 else if( db_allow_symlinks() && S_ISLNK(fx.fileStat.st_mode) )
303 return PERM_LNK;
304 }
305
--- src/file.c
+++ src/file.c
@@ -294,11 +294,11 @@
294 **
295 ** On windows, this routine returns only PERM_REG.
296 */
297 int file_perm(const char *zFilename, int eFType){
298 #if !defined(_WIN32)
299 if( !getStat(zFilename, eFType) ){
300 if( S_ISREG(fx.fileStat.st_mode) && ((S_IXUSR)&fx.fileStat.st_mode)!=0 )
301 return PERM_EXE;
302 else if( db_allow_symlinks() && S_ISLNK(fx.fileStat.st_mode) )
303 return PERM_LNK;
304 }
305
+1 -1
--- src/tar.c
+++ src/tar.c
@@ -443,11 +443,11 @@
443443
tar_begin(-1);
444444
for(i=3; i<g.argc; i++){
445445
Blob file;
446446
blob_zero(&file);
447447
blob_read_from_file(&file, g.argv[i], eFType);
448
- tar_add_file(g.argv[i], &file, file_perm(0,0), file_mtime(0,0));
448
+ tar_add_file(g.argv[i], &file, file_perm(0,eFType), file_mtime(0,eFType));
449449
blob_reset(&file);
450450
}
451451
tar_finish(&zip);
452452
blob_write_to_file(&zip, g.argv[2]);
453453
}
454454
--- src/tar.c
+++ src/tar.c
@@ -443,11 +443,11 @@
443 tar_begin(-1);
444 for(i=3; i<g.argc; i++){
445 Blob file;
446 blob_zero(&file);
447 blob_read_from_file(&file, g.argv[i], eFType);
448 tar_add_file(g.argv[i], &file, file_perm(0,0), file_mtime(0,0));
449 blob_reset(&file);
450 }
451 tar_finish(&zip);
452 blob_write_to_file(&zip, g.argv[2]);
453 }
454
--- src/tar.c
+++ src/tar.c
@@ -443,11 +443,11 @@
443 tar_begin(-1);
444 for(i=3; i<g.argc; i++){
445 Blob file;
446 blob_zero(&file);
447 blob_read_from_file(&file, g.argv[i], eFType);
448 tar_add_file(g.argv[i], &file, file_perm(0,eFType), file_mtime(0,eFType));
449 blob_reset(&file);
450 }
451 tar_finish(&zip);
452 blob_write_to_file(&zip, g.argv[2]);
453 }
454
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -592,11 +592,11 @@
592592
}
593593
zip_open();
594594
for(i=3; i<g.argc; i++){
595595
blob_zero(&file);
596596
blob_read_from_file(&file, g.argv[i], eFType);
597
- zip_add_file(&sArchive, g.argv[i], &file, file_perm(0,0));
597
+ zip_add_file(&sArchive, g.argv[i], &file, file_perm(0,eFType));
598598
blob_reset(&file);
599599
}
600600
zip_close(&sArchive);
601601
blob_write_to_file(&zip, g.argv[2]);
602602
}
603603
--- src/zip.c
+++ src/zip.c
@@ -592,11 +592,11 @@
592 }
593 zip_open();
594 for(i=3; i<g.argc; i++){
595 blob_zero(&file);
596 blob_read_from_file(&file, g.argv[i], eFType);
597 zip_add_file(&sArchive, g.argv[i], &file, file_perm(0,0));
598 blob_reset(&file);
599 }
600 zip_close(&sArchive);
601 blob_write_to_file(&zip, g.argv[2]);
602 }
603
--- src/zip.c
+++ src/zip.c
@@ -592,11 +592,11 @@
592 }
593 zip_open();
594 for(i=3; i<g.argc; i++){
595 blob_zero(&file);
596 blob_read_from_file(&file, g.argv[i], eFType);
597 zip_add_file(&sArchive, g.argv[i], &file, file_perm(0,eFType));
598 blob_reset(&file);
599 }
600 zip_close(&sArchive);
601 blob_write_to_file(&zip, g.argv[2]);
602 }
603

Keyboard Shortcuts

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