Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit898a14e

Browse files
committed
Remove unused copy_dir() function from pg_upgrade.
1 parenta858ca1 commit898a14e

File tree

1 file changed

+0
-97
lines changed

1 file changed

+0
-97
lines changed

‎contrib/pg_upgrade/file.c

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ static intcopy_file(const char *fromfile, const char *tofile, bool force);
1717
#ifdefWIN32
1818
staticintwin32_pghardlink(constchar*src,constchar*dst);
1919
#endif
20-
#ifdefNOT_USED
21-
staticintcopy_dir(constchar*from,constchar*to,boolforce);
22-
#endif
2320

2421
#ifndefHAVE_SCANDIR
2522
staticintpg_scandir_internal(constchar*dirname,
@@ -381,97 +378,3 @@ win32_pghardlink(const char *src, const char *dst)
381378
return0;
382379
}
383380
#endif
384-
385-
386-
#ifdefNOT_USED
387-
/*
388-
* copy_dir()
389-
*
390-
*Copies either a directory or a single file within a directory.If the
391-
*source argument names a directory, we recursively copy that directory,
392-
*otherwise we copy a single file.
393-
*/
394-
staticint
395-
copy_dir(constchar*src,constchar*dst,boolforce)
396-
{
397-
DIR*srcdir;
398-
structdirent*de=NULL;
399-
structstatfst;
400-
401-
if (src==NULL||dst==NULL)
402-
return-1;
403-
404-
/*
405-
* Try to open the source directory - if it turns out not to be a
406-
* directory, assume that it's a file and copy that instead.
407-
*/
408-
if ((srcdir=opendir(src))==NULL)
409-
{
410-
if (errno==ENOTDIR)
411-
returncopy_file(src,dst, true);
412-
return-1;
413-
}
414-
415-
if (mkdir(dst,S_IRWXU)!=0)
416-
{
417-
/*
418-
* ignore directory already exist error
419-
*/
420-
if (errno!=EEXIST)
421-
return-1;
422-
}
423-
424-
while ((de=readdir(srcdir))!=NULL)
425-
{
426-
charsrc_file[MAXPGPATH];
427-
chardest_file[MAXPGPATH];
428-
429-
if (strcmp(de->d_name,".")==0||strcmp(de->d_name,"..")==0)
430-
continue;
431-
432-
memset(src_file,0,sizeof(src_file));
433-
memset(dest_file,0,sizeof(dest_file));
434-
435-
snprintf(src_file,sizeof(src_file),"%s/%s",src,de->d_name);
436-
snprintf(dest_file,sizeof(dest_file),"%s/%s",dst,de->d_name);
437-
438-
if (stat(src_file,&fst)<0)
439-
{
440-
if (srcdir!=NULL)
441-
{
442-
closedir(srcdir);
443-
srcdir=NULL;
444-
}
445-
446-
return-1;
447-
}
448-
449-
if (S_ISDIR(fst.st_mode))
450-
{
451-
/* recurse to handle subdirectories */
452-
if (force)
453-
copy_dir(src_file,dest_file, true);
454-
}
455-
elseif (S_ISREG(fst.st_mode))
456-
{
457-
if ((copy_file(src_file,dest_file,1))==-1)
458-
{
459-
if (srcdir!=NULL)
460-
{
461-
closedir(srcdir);
462-
srcdir=NULL;
463-
}
464-
return-1;
465-
}
466-
}
467-
}
468-
469-
if (srcdir!=NULL)
470-
{
471-
closedir(srcdir);
472-
srcdir=NULL;
473-
}
474-
return1;
475-
}
476-
477-
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp