dcmtk code error causes compile error

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
parameter
Posts: 1
Joined: Tue, 2010-03-02, 15:31

dcmtk code error causes compile error

#1 Post by parameter »

When I compile dcmtk, the compiler runs into a file named mkdictbi.cc in dcmdata folder. And there are couple lines such as:

#elif HAVE_GETLOGIN
static char*
getUserName(char* userString, int maxLen)
{
#if defined(_REENTRANT) && !defined(_WIN32) && !defined(__CYGWIN__)
// use getlogin_r instead of getlogin
return getlogin_r(userString, int maxLen)
#else
char* s;
s = getlogin(); // thread unsafe
if (s == NULL) s = "<no-utmp-entry>";
return strncpy(userString, s, maxLen);
#endif
}

I think the line
return getlogin_r(userString, int maxLen)
has two errors.
1. Miss a ; at the end of the line
2. getlogin_r returns int not char*

Anyone can give me any explanation on this?
I appreciate any kind of suggestions.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Thank you for the report. A possible fix would look like the following:

Code: Select all

<     return getlogin_r(userString, int maxLen)
---
>     if (getlogin_r(userString, maxLen) != 0)
>         strncpy(userString, "<no-utmp-entry>", maxLen);
>     return userString;

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests