Skip to content

Commit 74be868

Browse files
committed
Fix MinGW warnings re formats and unused variables. per ITAGAKI Takahiro
1 parent d18f5c3 commit 74be868

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

src/backend/port/win32/signal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.20 2008/01/01 19:45:51 momjian Exp $
9+
* $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.21 2008/04/16 22:16:00 adunstan Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -251,7 +251,7 @@ pg_signal_thread(LPVOID param)
251251
char pipename[128];
252252
HANDLE pipe = pgwin32_initial_signal_pipe;
253253

254-
snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", GetCurrentProcessId());
254+
snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%lu", GetCurrentProcessId());
255255

256256
for (;;)
257257
{

src/port/exec.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.59 2008/03/31 01:31:43 tgl Exp $
12+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.60 2008/04/16 22:16:00 adunstan Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -695,7 +695,6 @@ AddUserToDacl(HANDLE hProcess)
695695
DWORD dwNewAclSize;
696696
DWORD dwSize = 0;
697697
DWORD dwTokenInfoLength = 0;
698-
DWORD dwResult = 0;
699698
HANDLE hToken = NULL;
700699
PACL pacl = NULL;
701700
PSID psidUser = NULL;
@@ -707,7 +706,7 @@ AddUserToDacl(HANDLE hProcess)
707706
/* Get the token for the process */
708707
if (!OpenProcessToken(hProcess, TOKEN_QUERY | TOKEN_ADJUST_DEFAULT, &hToken))
709708
{
710-
log_error("could not open process token: %ui", GetLastError());
709+
log_error("could not open process token: %lu", GetLastError());
711710
goto cleanup;
712711
}
713712

@@ -719,19 +718,19 @@ AddUserToDacl(HANDLE hProcess)
719718
ptdd = (TOKEN_DEFAULT_DACL *) LocalAlloc(LPTR, dwSize);
720719
if (ptdd == NULL)
721720
{
722-
log_error("could not allocate %i bytes of memory", dwSize);
721+
log_error("could not allocate %lu bytes of memory", dwSize);
723722
goto cleanup;
724723
}
725724

726725
if (!GetTokenInformation(hToken, tic, (LPVOID) ptdd, dwSize, &dwSize))
727726
{
728-
log_error("could not get token information: %ui", GetLastError());
727+
log_error("could not get token information: %lu", GetLastError());
729728
goto cleanup;
730729
}
731730
}
732731
else
733732
{
734-
log_error("could not get token information buffer size: %ui", GetLastError());
733+
log_error("could not get token information buffer size: %lu", GetLastError());
735734
goto cleanup;
736735
}
737736
}
@@ -741,14 +740,14 @@ AddUserToDacl(HANDLE hProcess)
741740
(DWORD) sizeof(ACL_SIZE_INFORMATION),
742741
AclSizeInformation))
743742
{
744-
log_error("could not get ACL information: %ui", GetLastError());
743+
log_error("could not get ACL information: %lu", GetLastError());
745744
goto cleanup;
746745
}
747746

748747
/* Get the SID for the current user. We need to add this to the ACL. */
749748
if (!GetUserSid(&psidUser, hToken))
750749
{
751-
log_error("could not get user SID: %ui", GetLastError());
750+
log_error("could not get user SID: %lu", GetLastError());
752751
goto cleanup;
753752
}
754753

@@ -759,13 +758,13 @@ AddUserToDacl(HANDLE hProcess)
759758
pacl = (PACL) LocalAlloc(LPTR, dwNewAclSize);
760759
if (pacl == NULL)
761760
{
762-
log_error("could not allocate %i bytes of memory", dwNewAclSize);
761+
log_error("could not allocate %lu bytes of memory", dwNewAclSize);
763762
goto cleanup;
764763
}
765764

766765
if (!InitializeAcl(pacl, dwNewAclSize, ACL_REVISION))
767766
{
768-
log_error("could not initialize ACL: %ui", GetLastError());
767+
log_error("could not initialize ACL: %lu", GetLastError());
769768
goto cleanup;
770769
}
771770

@@ -774,21 +773,21 @@ AddUserToDacl(HANDLE hProcess)
774773
{
775774
if (!GetAce(ptdd->DefaultDacl, i, (LPVOID *) & pace))
776775
{
777-
log_error("could not get ACE: %ui", GetLastError());
776+
log_error("could not get ACE: %lu", GetLastError());
778777
goto cleanup;
779778
}
780779

781780
if (!AddAce(pacl, ACL_REVISION, MAXDWORD, pace, ((PACE_HEADER) pace)->AceSize))
782781
{
783-
log_error("could not add ACE: %ui", GetLastError());
782+
log_error("could not add ACE: %lu", GetLastError());
784783
goto cleanup;
785784
}
786785
}
787786

788787
/* Add the new ACE for the current user */
789788
if (!AddAccessAllowedAce(pacl, ACL_REVISION, GENERIC_ALL, psidUser))
790789
{
791-
log_error("could not add access allowed ACE: %ui", GetLastError());
790+
log_error("could not add access allowed ACE: %lu", GetLastError());
792791
goto cleanup;
793792
}
794793

@@ -797,7 +796,7 @@ AddUserToDacl(HANDLE hProcess)
797796

798797
if (!SetTokenInformation(hToken, tic, (LPVOID) & tddNew, dwNewAclSize))
799798
{
800-
log_error("could not set token information: %ui", GetLastError());
799+
log_error("could not set token information: %lu", GetLastError());
801800
goto cleanup;
802801
}
803802

@@ -828,8 +827,6 @@ static BOOL
828827
GetUserSid(PSID * ppSidUser, HANDLE hToken)
829828
{
830829
DWORD dwLength;
831-
DWORD cbName = 250;
832-
DWORD cbDomainName = 250;
833830
PTOKEN_USER pTokenUser = NULL;
834831

835832

@@ -845,13 +842,13 @@ GetUserSid(PSID * ppSidUser, HANDLE hToken)
845842

846843
if (pTokenUser == NULL)
847844
{
848-
log_error("could not allocate %ui bytes of memory", dwLength);
845+
log_error("could not allocate %lu bytes of memory", dwLength);
849846
return FALSE;
850847
}
851848
}
852849
else
853850
{
854-
log_error("could not get token information buffer size: %ui", GetLastError());
851+
log_error("could not get token information buffer size: %lu", GetLastError());
855852
return FALSE;
856853
}
857854
}
@@ -865,7 +862,7 @@ GetUserSid(PSID * ppSidUser, HANDLE hToken)
865862
HeapFree(GetProcessHeap(), 0, pTokenUser);
866863
pTokenUser = NULL;
867864

868-
log_error("could not get token information: %ui", GetLastError());
865+
log_error("could not get token information: %lu", GetLastError());
869866
return FALSE;
870867
}
871868

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy