aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/utils/adt/dbsize.c4
-rw-r--r--src/backend/utils/adt/genfile.c4
-rw-r--r--src/port/copydir.c6
-rw-r--r--src/port/exec.c10
-rw-r--r--src/test/regress/pg_regress.c4
5 files changed, 14 insertions, 14 deletions
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index 72807321ae3..7b8aa6b9e67 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -5,7 +5,7 @@
* Copyright (c) 2002-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.17 2008/03/25 22:42:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.18 2008/03/31 01:31:43 tgl Exp $
*
*/
@@ -209,7 +209,7 @@ calculate_tablespace_size(Oid tblspcOid)
errmsg("could not stat file \"%s\": %m", pathname)));
}
- if (fst.st_mode & S_IFDIR)
+ if (S_ISDIR(fst.st_mode))
totalsize += db_dir_size(pathname);
totalsize += fst.st_size;
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index 86408859f22..38ec51313b3 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -9,7 +9,7 @@
* Author: Andreas Pflug <pgadmin@pse-consulting.de>
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.18 2008/03/25 22:42:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.19 2008/03/31 01:31:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -198,7 +198,7 @@ pg_stat_file(PG_FUNCTION_ARGS)
isnull[3] = true;
values[4] = TimestampTzGetDatum(time_t_to_timestamptz(fst.st_ctime));
#endif
- values[5] = BoolGetDatum(fst.st_mode & S_IFDIR);
+ values[5] = BoolGetDatum(S_ISDIR(fst.st_mode));
tuple = heap_form_tuple(tupdesc, values, isnull);
diff --git a/src/port/copydir.c b/src/port/copydir.c
index 540384597ca..a39b98f203c 100644
--- a/src/port/copydir.c
+++ b/src/port/copydir.c
@@ -11,7 +11,7 @@
* as a service.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/copydir.c,v 1.21 2008/01/01 19:46:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/copydir.c,v 1.22 2008/03/31 01:31:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,13 +80,13 @@ copydir(char *fromdir, char *todir, bool recurse)
(errcode_for_file_access(),
errmsg("could not stat file \"%s\": %m", fromfile)));
- if (fst.st_mode & S_IFDIR)
+ if (S_ISDIR(fst.st_mode))
{
/* recurse to handle subdirectories */
if (recurse)
copydir(fromfile, tofile, true);
}
- else if (fst.st_mode & S_IFREG)
+ else if (S_ISREG(fst.st_mode))
copy_file(fromfile, tofile);
}
diff --git a/src/port/exec.c b/src/port/exec.c
index e9a60d67fcc..37d109ec5cc 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.58 2008/02/29 15:31:33 mha Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.59 2008/03/31 01:31:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,8 +80,8 @@ validate_exec(const char *path)
#else
char path_exe[MAXPGPATH + sizeof(".exe") - 1];
#endif
- int is_r = 0;
- int is_x = 0;
+ int is_r;
+ int is_x;
#ifdef WIN32
/* Win32 requires a .exe suffix for stat() */
@@ -103,7 +103,7 @@ validate_exec(const char *path)
if (stat(path, &buf) < 0)
return -1;
- if ((buf.st_mode & S_IFMT) != S_IFREG)
+ if (!S_ISREG(buf.st_mode))
return -1;
/*
@@ -331,7 +331,7 @@ resolve_symlinks(char *path)
fname = path;
if (lstat(fname, &buf) < 0 ||
- (buf.st_mode & S_IFMT) != S_IFLNK)
+ !S_ISLNK(buf.st_mode))
break;
rllen = readlink(fname, link_buf, sizeof(link_buf));
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 71ef94d2d5a..2fa64f1fb0a 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.43 2008/03/04 15:38:31 mha Exp $
+ * $PostgreSQL: pgsql/src/test/regress/pg_regress.c,v 1.44 2008/03/31 01:31:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1102,7 +1102,7 @@ directory_exists(const char *dir)
if (stat(dir, &st) != 0)
return false;
- if (st.st_mode & S_IFDIR)
+ if (S_ISDIR(st.st_mode))
return true;
return false;
}