Changeset c9a6e18 in git for src/message.c


Ignore:
Timestamp:
29/06/19 03:07:43 (4 months ago)
Author:
Olly Betts <olly@…>
Branches:
master
Children:
9fe70e44
Parents:
41cd172
git-author:
Olly Betts <olly@…> (29/06/19 03:06:19)
git-committer:
Olly Betts <olly@…> (29/06/19 03:07:43)
Message:

Dereference symlinks when testing for file/directory

The code was carefully using lstat() where available to try to do
this, but that's backwards - regular stat() dereferences a symlink
and lstat() doesn't!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/message.c

    r41cd172 rc9a6e18  
    937937          * share directory and the binaries in the same directory. */
    938938         p = use_path(pth, "share/survex/en.msg");
    939          if (lstat(p, &buf) == 0 && S_ISREG(buf.st_mode)) {
     939         if (stat(p, &buf) == 0 && S_ISREG(buf.st_mode)) {
    940940            pth_cfg_files = use_path(pth, "share/survex");
    941941            msg_macosx_relocatable = 1;
     
    949949          */
    950950         p = use_path(pth, "../Resources/en.msg");
    951          if (lstat(p, &buf) == 0 && S_ISREG(buf.st_mode)) {
     951         if (stat(p, &buf) == 0 && S_ISREG(buf.st_mode)) {
    952952            pth_cfg_files = use_path(pth, "../Resources");
    953953            msg_macosx_relocatable = 1;
     
    961961          * tree easily. */
    962962         p = use_path(pth, "../lib/en.msg");
    963          if (lstat(p, &buf) == 0) {
     963         if (stat(p, &buf) == 0) {
    964964#ifdef S_ISREG
    965965            /* POSIX way */
Note: See TracChangeset for help on using the changeset viewer.