mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2025-01-15 08:52:08 +08:00
Fix compilation warning/error (#74)
Fix `comparison between signed and unsigned integer expressions` problem. User ID is a positive integer in Linux/UNIX(macOS, FreeBSD, Solaris), also `geteuid()` never fails with return code.
This commit is contained in:
parent
e18babe559
commit
196bb34af6
@ -118,11 +118,9 @@ void SingleApplicationPrivate::genBlockServerName()
|
|||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
QByteArray username;
|
QByteArray username;
|
||||||
uid_t uid = geteuid();
|
uid_t uid = geteuid();
|
||||||
if( uid != -1 ) {
|
struct passwd *pw = getpwuid(uid);
|
||||||
struct passwd *pw = getpwuid(uid);
|
if( pw ) {
|
||||||
if( pw ) {
|
username = pw->pw_name;
|
||||||
username = pw->pw_name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if( username.isEmpty() ) {
|
if( username.isEmpty() ) {
|
||||||
username = qgetenv("USER");
|
username = qgetenv("USER");
|
||||||
|
Loading…
Reference in New Issue
Block a user