Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
bb17a98e
Commit
bb17a98e
authored
Feb 13, 2005
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print file name and errno string on rmtree failure.
Backpatch to 8.0.X.
parent
c6521b1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
src/port/dirmod.c
src/port/dirmod.c
+17
-13
No files found.
src/port/dirmod.c
View file @
bb17a98e
...
...
@@ -10,7 +10,7 @@
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.3
4 2004/12/31 22:03:53 pgsql
Exp $
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.3
5 2005/02/13 16:50:44 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -350,6 +350,7 @@ fnames(char *path)
return
filenames
;
}
/*
* fnames_cleanup
*
...
...
@@ -366,6 +367,7 @@ fnames_cleanup(char **filenames)
pfree
(
filenames
);
}
/*
* rmtree
*
...
...
@@ -398,16 +400,14 @@ rmtree(char *path, bool rmtopdir)
snprintf
(
filepath
,
MAXPGPATH
,
"%s/%s"
,
path
,
*
filename
);
if
(
stat
(
filepath
,
&
statbuf
)
!=
0
)
{
fnames_cleanup
(
filenames
);
return
false
;
}
goto
report_and_fail
;
if
(
S_ISDIR
(
statbuf
.
st_mode
))
{
/* call ourselves recursively for a directory */
if
(
!
rmtree
(
filepath
,
true
))
{
/* we already reported the error */
fnames_cleanup
(
filenames
);
return
false
;
}
...
...
@@ -415,22 +415,26 @@ rmtree(char *path, bool rmtopdir)
else
{
if
(
unlink
(
filepath
)
!=
0
)
{
fnames_cleanup
(
filenames
);
return
false
;
}
goto
report_and_fail
;
}
}
if
(
rmtopdir
)
{
if
(
rmdir
(
path
)
!=
0
)
{
fnames_cleanup
(
filenames
);
return
false
;
}
goto
report_and_fail
;
}
fnames_cleanup
(
filenames
);
return
true
;
report_and_fail:
#ifndef FRONTEND
elog
(
WARNING
,
"could not remove file or directory
\"
%s
\"
: %m"
,
filepath
);
#else
fprintf
(
stderr
,
"could not remove file or directory
\"
%s
\"
: %s
\n
"
,
filepath
,
strerror
(
errno
));
#endif
fnames_cleanup
(
filenames
);
return
false
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment