Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9438) Patch: fix win32 GetUserName() invokation
Home

[Freeciv-Dev] (PR#9438) Patch: fix win32 GetUserName() invokation

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9438) Patch: fix win32 GetUserName() invokation
From: "res" <resqu@xxxxxx>
Date: Tue, 20 Jul 2004 07:24:29 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9438 >

GetUserName() has to be called with the 'nSize' parameter set to the 
name buffer size. An unitialized value was passed in this parameter, 
causing user name retrieval on Win32 to not work at all.


Index: utility/shared.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/shared.c,v
retrieving revision 1.114
diff -u -r1.114 shared.c
--- utility/shared.c    25 May 2004 00:41:17 -0000      1.114
+++ utility/shared.c    20 Jul 2004 14:16:30 -0000
@@ -761,8 +764,8 @@
 #ifdef WIN32_NATIVE
   /* On win32 the GetUserName function will give us the login name. */
   {
-    DWORD length;
     char name[UNLEN + 1];
+    DWORD length = sizeof(name);
 
     if (GetUserName(name, &length)) {
       sz_strlcpy(username, name);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9438) Patch: fix win32 GetUserName() invokation, res <=