mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 13:58:14 +00:00
util: Set program_name for windows correctly.
Windows path uses backward slashes. Also, the executable name has a .exe extension in it. While creating log files, we use the program name to create log file names. It feels a little odd to have log file names like ovsdb-server.exe.log etc. Using _splitpath_s() is a way to have same log file names on both windows and linux platforms. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
parent
490db96efa
commit
ed596d3a10
13
lib/util.c
13
lib/util.c
@ -373,11 +373,18 @@ void
|
||||
set_program_name__(const char *argv0, const char *version, const char *date,
|
||||
const char *time)
|
||||
{
|
||||
const char *slash = strrchr(argv0, '/');
|
||||
|
||||
#ifdef _WIN32
|
||||
char *basename;
|
||||
size_t max_len = strlen(argv0) + 1;
|
||||
basename = xmalloc(max_len);
|
||||
_splitpath_s(argv0, NULL, 0, NULL, 0, basename, max_len, NULL, 0);
|
||||
assert_single_threaded();
|
||||
program_name = basename;
|
||||
#else
|
||||
const char *slash = strrchr(argv0, '/');
|
||||
assert_single_threaded();
|
||||
|
||||
program_name = slash ? slash + 1 : argv0;
|
||||
#endif
|
||||
|
||||
free(program_version);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user