summaryrefslogtreecommitdiff
path: root/src/port/path.c
AgeCommit message (Collapse)Author
2013-01-01Update copyrights for 2013Bruce Momjian
Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
2012-07-05Don't try to trim "../" in join_path_components().Tom Lane
join_path_components() tried to remove leading ".." components from its tail argument, but it was not nearly bright enough to do so correctly unless the head argument was (a) absolute and (b) canonicalized. Rather than try to fix that logic, let's just get rid of it: there is no correctness reason to remove "..", and cosmetic concerns can be taken care of by a subsequent canonicalize_path() call. Per bug #6715 from Greg Davidson. Back-patch to all supported branches. It appears that pre-9.2, this function is only used with absolute paths as head arguments, which is why we'd not noticed the breakage before. However, third-party code might be expecting this function to work in more general cases, so it seems wise to back-patch. In HEAD and 9.2, also make some minor cosmetic improvements to callers.
2012-06-10Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian
commit-fest.
2012-01-30Use abort() instead of exit() to abort library functionsPeter Eisentraut
In some hopeless situations, certain library functions in libpq and libpgport quit the program. Use abort() for that instead of exit(), so we don't interfere with the normal exit codes the program might use, we clearly signal the abnormal termination, and the caller has a chance of catching the termination. This was originally pointed out by Debian's Lintian program.
2012-01-01Update copyright notices for year 2012.Bruce Momjian
2011-11-26Fix join_path_components() to not add a leading slash when joining to anBruce Momjian
initial null string. Per report from Robert Haas in testing psql \ir.
2011-07-06Add \ir command to psql.Robert Haas
\ir is short for "include relative"; when used from a script, the supplied pathname will be interpreted relative to the input file, rather than to the current working directory. Gurjeet Singh, reviewed by Josh Kupershmidt, with substantial further cleanup by me.
2011-06-29Unify spelling of "canceled", "canceling", "cancellation"Peter Eisentraut
We had previously (af26857a2775e7ceb0916155e931008c2116632f) established the U.S. spellings as standard.
2011-04-10pgindent run before PG 9.1 beta 1.Bruce Momjian
2011-02-13Fix reverse 'if' test in path_is_relative_and_below_cwd(), per Tom.Bruce Momjian
2011-02-12Properly handle Win32 paths of 'E:abc', which can be either absolute orBruce Momjian
relative, by creating a function path_is_relative_and_below_cwd() to check for specific requirements. It is unclear if this fixes a security problem or not but the new code is more robust.
2011-02-03Simplify code used in is_absolute_path() macro; also add comment aboutBruce Momjian
'E:abc' Win32 path handling.
2011-02-02Rename function to first_path_var_separator() to clarify it works withBruce Momjian
path variables, not directory paths.
2011-02-02Clearify macro IS_PATH_VAR_SEP in path.c so it is clear this is a pathBruce Momjian
variable, not a directory path.
2011-01-01Stamp copyrights for year 2011.Bruce Momjian
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2010-01-02Update copyright for the year 2010.Bruce Momjian
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.
2009-04-03Use (unsigned char) cast in argument of pg_tolower(). Maybe it works onTom Lane
Windows without that, but we shouldn't put bad examples where people might copy them. Also, reformat slightly to improve the odds that pgindent won't go nuts on this.
2009-04-03Make directory name comparisons on Win32 case insensitive.Magnus Hagander
This method will not catch all different ways since the locale handling in NTFS doesn't provide an easy way to do that, but it will hopefully solve the most common cases causing startup problems when the backend is found in the system PATH. Attempts to fix bug #4694.
2009-01-01Update copyright for 2009.Bruce Momjian
2008-02-18Added --htmldir option to pg_config, equivalent to the new configure option.Peter Eisentraut
2008-01-01Update copyrights in source tree to 2008.Bruce Momjian
2007-11-15pgindent run for 8.3.Bruce Momjian
2007-10-23Use snprintf instead of wsprintf, and use getenv("APPDATA") instead ofMagnus Hagander
SHGetFolderPath. This removes the direct dependency on shell32.dll and user32.dll, which eats a lot of "desktop heap" for each backend that's started. The desktop heap is a very limited resource, causing backends to no longer start once it's been exhausted. We still have indirect depdendencies on user32.dll through third party libraries, but those can't easily be removed. Dave Page
2007-01-05Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian
back-stamped for this.
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-09-27Replace strncpy with strlcpy in selected places that seem possibly relevantTom Lane
to performance. (A wholesale effort to get rid of strncpy should be undertaken sometime, but not during beta.) This commit also fixes dynahash.c to correctly truncate overlength string keys for hashtables, so that its callers don't have to anymore.
2006-09-22Fix bugs in plpgsql and ecpg caused by assuming that isspace() would onlyTom Lane
return true for exactly the characters treated as whitespace by their flex scanners. Per report from Victor Snezhko and subsequent investigation. Also fix a passel of unsafe usages of <ctype.h> functions, that is, ye olde char-vs-unsigned-char issue. I won't miss <ctype.h> when we are finally able to stop using it.
2006-09-11Move set_pglocale_pgservice() from path.c to exec.c, so that pulling inTom Lane
path.c does not in itself force linking of both exec.c and libintl. Should fix current ecpglib build failure on pickier platforms.
2006-03-05Update copyright for 2006. Update scripts.Bruce Momjian
2006-02-01Fix const cast in get_progname().Bruce Momjian
Backpatch.
2006-02-01Set progname early in the postmaster/postgres binary, rather than doingBruce Momjian
it later. This fixes a problem where EXEC_BACKEND didn't have progname set, causing a segfault if log_min_messages was set below debug2 and our own snprintf.c was being used. Also alway strdup() progname. Backpatch to 8.1.X and 8.0.X.
2005-12-23Fix make_relative_path() to support cases where target_path and bin_pathTom Lane
differ by more than the last directory component. Instead of insisting that they match up to the last component, accept whatever common prefix they have, and try to replace the non-matching part of bin_path with the non-matching part of target_path in the actual executable's path. In one way this is tighter than the old code, because it insists on a match to the part of bin_path we want to substitute for, rather than blindly stripping one directory component from the executable's path. Per gripe from Martin Pitt and subsequent discussion.
2005-11-22Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian
comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-10-13Use get_progname() in backend main.c, rather than port-specific hackBruce Momjian
that is too fragile.
2005-09-27Fix problems with PGXS builds against an installation tree that wasTom Lane
relocated after installation. We can't trust the installation paths inserted into Makefile.global by configure, so instead we must get the paths from pg_config. This requires extending pg_config to support all the separately-configurable path names, but that was on TODO anyway.
2005-08-29Fix platform-specific test for path prefix-ness: move it into path.c whereTom Lane
it can be done right. Allow explicit use of absolute DataDir path. Per Dave Page.
2005-08-12Fix up canonicalize_path to do the right thing in all cases (I think ...Tom Lane
this was harder than it seemed at first glance). Also push code for checking for ".." in file names into path.c where it belongs.
2005-08-12Reverse out changes to canonicalize_path(), per suggestion from Tom.Bruce Momjian
2005-08-12Modify canonicalize_path() so if we would return a trailing "..", throwBruce Momjian
an error instead.
2005-08-12Update comments.Bruce Momjian
2005-08-12Document why we only handle trailing "..".Bruce Momjian
2005-08-11Fix canonicalize_path so "../.." isn't stripped off and ignored.Bruce Momjian
2005-01-26Use SHGetFolderPath instead of SHGetSpecialFolderPath to find theTom Lane
APPDATA directory on Windows. Magnus Hagander
2005-01-10Un-break MSVC build, per Andrew Dunstan.Tom Lane
2005-01-06Minor mop-up for Windows home-directory stuff, per Magnus.Tom Lane
2005-01-06Adjust lookup of client-side profile files (.pgpass and so on) as perTom Lane
discussion on pgsql-hackers-win32 list. Documentation still needs to be tweaked --- I'm not sure how to refer to the APPDATA folder in user documentation.
2005-01-06Make the various places that determine the user's "home directory"Tom Lane
consistent. On Unix we now always consult getpwuid(); $HOME isn't used at all. On Windows the code currently consults $USERPROFILE, or $HOME if that's not defined, but I expect this will change as soon as the win32 hackers come to a consensus. Nothing done yet about changing the file names used underneath $USERPROFILE.