Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
88
Issues
88
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
d81cbc4a
Commit
d81cbc4a
authored
Feb 27, 2017
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use uname() instead of CMAKE_SYSTEM
fix
#3235
parent
9f978cda
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
2 deletions
+38
-2
louloulibs/louloulibs.h.cmake
louloulibs/louloulibs.h.cmake
+0
-1
louloulibs/utils/system.cpp
louloulibs/utils/system.cpp
+21
-0
louloulibs/utils/system.hpp
louloulibs/utils/system.hpp
+8
-0
louloulibs/xmpp/xmpp_component.cpp
louloulibs/xmpp/xmpp_component.cpp
+2
-1
tests/utils.cpp
tests/utils.cpp
+7
-0
No files found.
louloulibs/louloulibs.h.cmake
View file @
d81cbc4a
#define SYSTEM_NAME "${CMAKE_SYSTEM}"
#cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST
#cmakedefine LIBIDN_FOUND
#cmakedefine SYSTEMD_FOUND
...
...
louloulibs/utils/system.cpp
0 → 100644
View file @
d81cbc4a
#include <logger/logger.hpp>
#include <utils/system.hpp>
#include <sys/utsname.h>
#include <cstring>
using
namespace
std
::
string_literals
;
namespace
utils
{
std
::
string
get_system_name
()
{
struct
utsname
uts
;
const
int
res
=
::
uname
(
&
uts
);
if
(
res
==
-
1
)
{
log_error
(
"uname failed: "
,
std
::
strerror
(
errno
));
return
"Unknown"
;
}
return
uts
.
sysname
+
" "
s
+
uts
.
release
;
}
}
\ No newline at end of file
louloulibs/utils/system.hpp
0 → 100644
View file @
d81cbc4a
#pragma once
#include <string>
namespace
utils
{
std
::
string
get_system_name
();
}
\ No newline at end of file
louloulibs/xmpp/xmpp_component.cpp
View file @
d81cbc4a
...
...
@@ -5,6 +5,7 @@
#include <xmpp/xmpp_component.hpp>
#include <config/config.hpp>
#include <utils/system.hpp>
#include <utils/time.hpp>
#include <xmpp/auth.hpp>
#include <xmpp/jid.hpp>
...
...
@@ -585,7 +586,7 @@ void XmppComponent::send_version(const std::string& id, const std::string& jid_t
}
{
XmlSubNode
os
(
query
,
"os"
);
os
.
set_inner
(
SYSTEM_NAME
);
os
.
set_inner
(
utils
::
get_system_name
()
);
}
}
else
...
...
tests/utils.cpp
View file @
d81cbc4a
...
...
@@ -8,6 +8,7 @@
#include <utils/empty_if_fixed_server.hpp>
#include <utils/get_first_non_empty.hpp>
#include <utils/time.hpp>
#include <utils/system.hpp>
#include <utils/scopeguard.hpp>
using
namespace
std
::
string_literals
;
...
...
@@ -151,3 +152,9 @@ TEST_CASE("scope_guard")
}
CHECK
(
res
);
}
TEST_CASE
(
"system_name"
)
{
CHECK
(
utils
::
get_system_name
()
!=
"Unknown"
);
CHECK
(
!
utils
::
get_system_name
().
empty
());
}
\ No newline at end of file
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