Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
03544b3a
Commit
03544b3a
authored
Dec 29, 2019
by
Ulrich Sibiller
Committed by
Mike Gabriel
Jan 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Error.c: make nxagentClientsLogName a pointer
no more hardcoded string length
parent
2a4af0c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
12 deletions
+22
-12
Args.c
nx-X11/programs/Xserver/hw/nxagent/Args.c
+11
-1
Error.c
nx-X11/programs/Xserver/hw/nxagent/Error.c
+10
-9
Error.h
nx-X11/programs/Xserver/hw/nxagent/Error.h
+1
-2
No files found.
nx-X11/programs/Xserver/hw/nxagent/Args.c
View file @
03544b3a
...
...
@@ -1296,7 +1296,17 @@ static void nxagentParseSingleOption(char *name, char *value)
}
else
if
(
strcmp
(
name
,
"clients"
)
==
0
)
{
snprintf
(
nxagentClientsLogName
,
NXAGENTCLIENTSLOGNAMELENGTH
,
"%s"
,
value
);
char
*
new
=
strdup
(
value
);
if
(
new
)
{
SAFE_free
(
nxagentClientsLogName
);
nxagentClientsLogName
=
new
;
}
else
{
fprintf
(
stderr
,
"Warning: Ignoring option [%s] because of memory problems
\n
"
,
validateString
(
name
));
}
return
;
}
else
if
(
strcmp
(
name
,
"client"
)
==
0
)
...
...
nx-X11/programs/Xserver/hw/nxagent/Error.c
View file @
03544b3a
...
...
@@ -79,7 +79,7 @@ static int nxagentClientsLog = -1;
* Clients log file name.
*/
char
nxagentClientsLogName
[
NXAGENTCLIENTSLOGNAMELENGTH
]
=
{
0
}
;
char
*
nxagentClientsLogName
=
NULL
;
/*
* User's home.
...
...
@@ -250,12 +250,12 @@ int nxagentExitHandler(const char *message)
void
nxagentOpenClientsLogFile
(
void
)
{
if
(
*
nxagentClientsLogName
==
'\0'
)
if
(
!
nxagentClientsLogName
)
{
nxagentGetClientsPath
();
}
if
(
nxagentClientsLogName
!=
NULL
&&
*
nxagentClientsLogName
!=
'\0'
)
if
(
nxagentClientsLogName
&&
*
nxagentClientsLogName
!=
'\0'
)
{
nxagentClientsLog
=
open
(
nxagentClientsLogName
,
O_RDWR
|
O_CREAT
|
O_APPEND
,
0600
);
...
...
@@ -553,7 +553,7 @@ char *nxagentGetSessionPath(void)
void
nxagentGetClientsPath
(
void
)
{
if
(
*
nxagentClientsLogName
==
'\0'
)
if
(
!
nxagentClientsLogName
)
{
char
*
sessionPath
=
nxagentGetSessionPath
();
...
...
@@ -562,16 +562,17 @@ void nxagentGetClientsPath(void)
return
;
}
if
(
strlen
(
sessionPath
)
+
strlen
(
"/clients"
)
>
NXAGENTCLIENTSLOGNAMELENGTH
-
1
)
/* FIXME: this is currently never freed as it is thought to last
over the complete runtime. We should add a free call at shutdown
eventually... */
int
len
=
asprintf
(
&
nxagentClientsLogName
,
"%s/clients"
,
sessionPath
);
if
(
len
==
-
1
)
{
#ifdef PANIC
fprintf
(
stderr
,
"
nxagentGetClientsPath: PANIC! Invalid value for the NX clients Log File Path ''.
\n
"
);
fprintf
(
stderr
,
"
%s: PANIC! Could not alloc NX clients Log File Path.
\n
"
,
__func__
);
#endif
return
;
}
snprintf
(
nxagentClientsLogName
,
NXAGENTCLIENTSLOGNAMELENGTH
,
"%s/clients"
,
sessionPath
);
}
return
;
...
...
nx-X11/programs/Xserver/hw/nxagent/Error.h
View file @
03544b3a
...
...
@@ -30,8 +30,7 @@
* Clients log file name.
*/
#define NXAGENTCLIENTSLOGNAMELENGTH 256
extern
char
nxagentClientsLogName
[
NXAGENTCLIENTSLOGNAMELENGTH
];
extern
char
*
nxagentClientsLogName
;
extern
char
nxagentVerbose
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment