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
4 files changed, 12 insertions, 12 deletions
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index 757b97dc334..47133f948d0 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -5,7 +5,7 @@
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.7.2.1 2007/03/11 06:43:23 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.7.2.2 2008/03/31 01:32:48 tgl Exp $
*
*/
@@ -186,7 +186,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 e51be2b2297..e7c9c483f7a 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.9 2005/10/29 00:31:51 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/genfile.c,v 1.9.2.1 2008/03/31 01:32:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -205,7 +205,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 8fcfa1acdef..d98b71933d3 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.16 2005/10/29 00:31:52 petere Exp $
+ * $PostgreSQL: pgsql/src/port/copydir.c,v 1.16.2.1 2008/03/31 01:32:48 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 5f0f6959f54..1fa2d5d8fec 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.39.2.1 2005/11/22 18:23:31 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.39.2.2 2008/03/31 01:32:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -78,8 +78,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() */
@@ -101,7 +101,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;
/*
@@ -329,7 +329,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));