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

Commitfa248a0

Browse files
author
Michael Paquier
committed
Remove custom version of readlink in pgut_port
Postgres has its own version in lpgport relying on junction points,so if we consider a WIN32 port this is actually not necessary.
1 parent1ae2feb commitfa248a0

File tree

2 files changed

+0
-125
lines changed

2 files changed

+0
-125
lines changed

‎pgut/pgut-port.c

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -15,117 +15,6 @@
1515
#include<unistd.h>
1616
#include<fcntl.h>
1717

18-
#ifdefWIN32
19-
20-
#include<winioctl.h>
21-
22-
#defineREPARSE_DATA_SIZE1024
23-
24-
/* same layout as REPARSE_DATA_BUFFER, which is defined only in old winnt.h */
25-
typedefstructREPARSE_DATA
26-
{
27-
ULONGReparseTag;
28-
WORDReparseDataLength;
29-
WORDReserved;
30-
union
31-
{
32-
struct
33-
{
34-
WORDSubstituteNameOffset;
35-
WORDSubstituteNameLength;
36-
WORDPrintNameOffset;
37-
WORDPrintNameLength;
38-
ULONGFlags;
39-
WCHARPathBuffer[1];
40-
}Symlink;
41-
struct
42-
{
43-
WORDSubstituteNameOffset;
44-
WORDSubstituteNameLength;
45-
WORDPrintNameOffset;
46-
WORDPrintNameLength;
47-
WCHARPathBuffer[1];
48-
}Mount;
49-
struct
50-
{
51-
BYTEDataBuffer[REPARSE_DATA_SIZE];
52-
}Generic;
53-
};
54-
}REPARSE_DATA;
55-
56-
ssize_t
57-
readlink(constchar*path,char*target,size_tsize)
58-
{
59-
HANDLEhandle;
60-
DWORDattr;
61-
REPARSE_DATAdata;
62-
DWORDdatasize;
63-
PCWSTRwpath;
64-
intwlen;
65-
intr;
66-
67-
attr=GetFileAttributes(path);
68-
if (attr==INVALID_FILE_ATTRIBUTES)
69-
{
70-
_dosmaperr(GetLastError());
71-
return-1;
72-
}
73-
if ((attr&FILE_ATTRIBUTE_REPARSE_POINT)==0)
74-
{
75-
errno=EINVAL;/* not a symlink */
76-
return-1;
77-
}
78-
79-
handle=CreateFileA(path,0,
80-
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,
81-
OPEN_EXISTING,
82-
FILE_FLAG_BACKUP_SEMANTICS |FILE_FLAG_OPEN_REPARSE_POINT,NULL);
83-
if (handle==INVALID_HANDLE_VALUE)
84-
{
85-
_dosmaperr(GetLastError());
86-
return-1;
87-
}
88-
89-
wpath=NULL;
90-
if (DeviceIoControl(handle,FSCTL_GET_REPARSE_POINT,NULL,0,
91-
&data,sizeof(data),&datasize,NULL))
92-
{
93-
switch (data.ReparseTag)
94-
{
95-
caseIO_REPARSE_TAG_MOUNT_POINT:
96-
{
97-
wpath=data.Mount.PathBuffer+data.Mount.SubstituteNameOffset;
98-
wlen=data.Mount.SubstituteNameLength;
99-
break;
100-
}
101-
caseIO_REPARSE_TAG_SYMLINK:
102-
{
103-
wpath=data.Symlink.PathBuffer+data.Symlink.SubstituteNameOffset;
104-
wlen=data.Symlink.SubstituteNameLength;
105-
break;
106-
}
107-
}
108-
}
109-
110-
if (wpath==NULL)
111-
r=-1;
112-
else
113-
{
114-
if (wcsncmp(wpath,L"\\??\\",4)==0||
115-
wcsncmp(wpath,L"\\\\?\\",4)==0)
116-
{
117-
wpath+=4;
118-
wlen-=4;
119-
}
120-
r=WideCharToMultiByte(CP_ACP,0,wpath,wlen,target,size,NULL,NULL);
121-
}
122-
123-
CloseHandle(handle);
124-
returnr;
125-
}
126-
127-
#endif
128-
12918
#ifdefPGUT_FLOCK
13019

13120
#ifdefWIN32

‎pgut/pgut-port.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@
1010
#ifndefPGUT_PORT_H
1111
#definePGUT_PORT_H
1212

13-
/*
14-
* readlink ports
15-
*/
16-
#ifdefWIN32
17-
18-
#defineS_IFLNK(0)
19-
#defineS_IRWXG(0)
20-
#defineS_IRWXO(0)
21-
#defineS_ISLNK(mode)(0)
22-
23-
externssize_treadlink(constchar*path,char*target,size_tsize);
24-
25-
#endif
26-
2713
/*
2814
* flock ports
2915
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp