8000 Get dirmod.c on the same page as port.h about whether we use pgsymlink · postgrespro/postgres_cluster@6bc12a4 · GitHub
[go: up one dir, main page]

Skip to content
  • Commit 6bc12a4

    Browse files
    committed
    Get dirmod.c on the same page as port.h about whether we use pgsymlink
    on Cygwin (answer: we don't). Also try to unwind the #ifdef spaghetti a little bit. Untested but hopefully I didn't break anything.
    1 parent ad44c95 commit 6bc12a4

    File tree

    2 files changed

    +18
    -14
    lines changed

    2 files changed

    +18
    -14
    lines changed

    src/include/port.h

    Lines changed: 8 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -6,7 +6,7 @@
    66
    * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
    77
    * Portions Copyright (c) 1994, Regents of the University of California
    88
    *
    9-
    * $PostgreSQL: pgsql/src/include/port.h,v 1.111 2007/04/13 10:30:30 mha Exp $
    9+
    * $PostgreSQL: pgsql/src/include/port.h,v 1.112 2007/07/12 23:28:49 tgl Exp $
    1010
    *
    1111
    *-------------------------------------------------------------------------
    1212
    */
    @@ -241,8 +241,7 @@ extern int pclose_check(FILE *stream);
    241241

    242242
    #if defined(WIN32) || defined(__CYGWIN__)
    243243
    /*
    244-
    * Win32 doesn't have reliable rename/unlink during concurrent access,
    245-
    * and we need special code to do symlinks.
    244+
    * Win32 doesn't have reliable rename/unlink during concurrent access.
    246245
    */
    247246
    extern int pgrename(const char *from, const char *to);
    248247
    extern int pgunlink(const char *path);
    @@ -255,9 +254,14 @@ extern int pgunlink(const char *path);
    255254
    #define rename(from, to) pgrename(from, to)
    256255
    #define unlink(path) pgunlink(path)
    257256

    257+
    #endif /* defined(WIN32) || defined(__CYGWIN__) */
    258+
    258259
    /*
    260+
    * Win32 also doesn't have symlinks, but we can emulate them with
    261+
    * junction points on newer Win32 versions.
    262+
    *
    259263
    * Cygwin has its own symlinks which work on Win95/98/ME where
    260-
    * junction points don't, so use it instead. We have no way of
    264+
    * junction points don't, so use those instead. We have no way of
    261265
    * knowing what type of system Cygwin binaries will be run on.
    262266
    * Note: Some CYGWIN includes might #define WIN32.
    263267
    */
    @@ -266,7 +270,6 @@ extern int pgsymlink(const char *oldpath, const char *newpath);
    266270

    267271
    #define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
    268272
    #endif
    269-
    #endif /* defined(WIN32) || defined(__CYGWIN__) */
    270273

    271274
    extern void copydir(char *fromdir, char *todir, bool recurse);
    272275

    src/port/dirmod.c

    Lines changed: 10 additions & 9 deletions
    Original file line numberDiff line numberDiff line change
    @@ -10,7 +10,7 @@
    1010
    * Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
    1111
    *
    1212
    * IDENTIFICATION
    13-
    * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.47 2007/01/19 16:42:24 alvherre Exp $
    13+
    * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.48 2007/07/12 23:28:49 tgl Exp $
    1414
    *
    1515
    *-------------------------------------------------------------------------
    1616
    */
    @@ -103,6 +103,7 @@ fe_repalloc(void *pointer, Size size)
    103103
    }
    104104
    return res;
    105105
    }
    106+
    106107
    #endif /* FRONTEND */
    107108

    108109

    @@ -169,8 +170,14 @@ pgunlink(const char *path)
    169170
    return 0;
    170171
    }
    171172

    173+
    /* We undefined these above; now redefine for possible use below */
    174+
    #define rename(from, to) pgrename(from, to)
    175+
    #define unlink(path) pgunlink(path)
    176+
    177+
    #endif /* defined(WIN32) || defined(__CYGWIN__) */
    178+
    172179

    173-
    #ifdef WIN32 /* Cygwin has its own symlinks */
    180+
    #if defined(WIN32) && !defined(__CYGWIN__) /* Cygwin has its own symlinks */
    174181

    175182
    /*
    176183
    * pgsymlink support:
    @@ -276,14 +283,8 @@ pgsymlink(const char *oldpath, const char *newpath)
    276283

    277284
    return 0;
    278285
    }
    279-
    #endif /* WIN32 */
    280-
    #endif /* defined(WIN32) || defined(__CYGWIN__) */
    281-
    282286

    283-
    /* We undefined this above, so we redefine it */
    284-
    #if defined(WIN32) || defined(__CYGWIN__)
    285-
    #define unlink(path) pgunlink(path)
    286-
    #endif
    287+
    #endif /* defined(WIN32) && !defined(__CYGWIN__) */
    287288

    288289

    289290
    /*

    0 commit comments

    Comments
     (0)
    0