Skip to content

Commit e4c245b

Browse files
committed
Args.c: make nxagentGetDialogName() more readable
1 parent 0670fbb commit e4c245b

File tree

1 file changed

+3
-4
lines changed
  • nx-X11/programs/Xserver/hw/nxagent

1 file changed

+3
-4
lines changed

nx-X11/programs/Xserver/hw/nxagent/Args.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,15 +1998,14 @@ static int nxagentGetDialogName()
19981998

19991999
if (*nxagentSessionId != '\0')
20002000
{
2001-
int length = strlen(nxagentSessionId);
2001+
int length = strlen(nxagentSessionId) - (MD5_LENGTH * 2 + 1);
20022002
const char prefix[] = "NX - ";
20032003

20042004
strcpy(nxagentDialogName, prefix);
20052005

2006-
if (length > (MD5_LENGTH * 2 + 1) &&
2007-
*(nxagentSessionId + (length - (MD5_LENGTH * 2 + 1))) == '-')
2006+
if (length > 0 && nxagentSessionId[length] == '-')
20082007
{
2009-
strncat(nxagentDialogName, nxagentSessionId, length - (MD5_LENGTH * 2 + 1));
2008+
strncat(nxagentDialogName, nxagentSessionId, length));
20102009
}
20112010
else
20122011
{

0 commit comments

Comments
 (0)