Not used by any external module/driver, so no need to keep it
public. Also move it to the new dix settings code and rename it.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
When compiling with gcc 15.2.0 using -O3 -m64 on Solaris SPARC & x64,
we'd get a test failure of:
Assertion failed: strcmp(logmsg, expected) == 0,
file ../test/signal-logging.c, line 339, function logging_format
because 'num *= -1' produced a value that was out of the range of the
int64_t it was being stored in. (Compiling with -O2 worked fine with
the same compiler/configuration/platform though.)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2117>
The section does some mappings between POSIX and windows APIs that are
already handled by Cygwin. This caused build errors on Cygwin due to
redefinition of things like the sigset_t struct.
Signed-off-by: b-aaz <b-aazbsd@proton.me>
Brought back the code removed in that commit so that we can bring back
Cygwin support.
Small changes are done in the process of resolving conflicts against the
current head.
Some checks have not been reverted, because they were not necessary
anymore.
Signed-off-by: b-aaz <b-aazbsd@proton.me>
In `Fopen` function variable `iop` may store NULL as a result of `fopen`
call. In this case, if later privileges couldn't be restored (`seteuid`
call fails), further `fclose(iop)` call will cause runtime error.
This commit adds check `iop` for NULL before calling `fclose` to prevent
potential NULL pointer dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2115>
The old function used int for write() return values, that could overflow.
And the return values of the write calls were discarded and not checked.
Now if the write() to the log file fails, a warning will be logged to
stderr and the log message will be appended after the warning.
If writes to stderr fail, a warning will be logged to stdout and the log
message will be appended after the warning.
If writes to stdout fail, we can't really do anything else and will
continue on silently.
Also used the length returned by strftime for the next write call to
eliminate an extra use of strlen.
The -1 was also removed from the buflen argument of strftime because it
was unnecessary.
Did some small formatting changes too.
Signed-off-by: b-aaz <b-aazbsd@proton.me>
> In file included from /usr/include/ctype.h:100,
> from ../include/misc.h:154,
> from ../include/os.h:51,
> from ../os/Xtransint.h:256,
> from ../os/transport.c:57:
> ../os/Xtranssock.c: In function ‘is_numeric’:
> ../os/Xtranssock.c:217:19: error: array subscript has type ‘char’ [-Werror=char-subscripts]
> 217 | if (!isdigit (str[i]))
> | ^
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Mingw32 also supports unix sockets, so no need to disable them here.
Since it's now always enabled, follow-up commits can now drop all the
extra #ifdef's on UNIXCONN and so reduce complexity.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
trans_mkdir() is needed for unix sockets, so the correct switch is
UNIXCONN, instead of WIN32.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
The symbol is never defined anywhere, so these dead code pathes
can be removed entirely.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
../os/utils.c: In function ‘VerifyDisplayName’:
../os/utils.c:624:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
624 | if (!isdigit(d[i])) {
| ^
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> ../os/xprintf.c: In function ‘XNFvasprintf’:
> ../os/xprintf.c:84:5: warning: function ‘XNFvasprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> 84 | int size = vasprintf(ret, format, va);
> | ^~~
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> In function ‘ConvertAddr’,
> inlined from ‘ResetHosts’ at ../os/access.c:1014:26:
> ../os/access.c:1540:25: warning: ‘saddr’ may be used uninitialized [-Wmaybe-uninitialized]
> 1540 | if (16777343 == *(long *) &((struct sockaddr_in *) saddr)->sin_addr)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../os/access.c: In function ‘ResetHosts’:
> ../os/access.c:908:7: note: ‘saddr’ declared here
> 908 | } saddr;
> | ^~~~~
The union isn't needed at all, we're just using one of the fields anyways.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Since xtrans is now in-tree and already have been trimmed down
for only things needed by the Xserver, the split between xstrans.c
and transport.c isn't needed anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Adding a new header for math related functions, beginning with new
MIN/MAX macros, which will be used by subsequent commits.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Adding new source and header that's going to host all DIX
settings (set via cmdline or xf86 config file) in the future.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Certain display managers (for example SDDM) starts X server with
-noreset flag and it is not user configurable. This patch add code to
ignore -noreset and -reset command line arguments to prevent X server
crash due to unknown arguments.
Signed-off-by: Tautvis <gtautvis@gmail.com>
Only internally within OS layer and screen saver logic,
so no need to keep it exported.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Since we're always terminating now, everbody can call UnlockServer()
directly, so we don't need that extra function anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Drop the -reset flag, so Xserver now either simply continues (w/o going
through internal reset) when last client disconnected or terminates
when -terminate is given.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
They're only used inside os/connection.c, so no need to have them
in some header and expose them to other areas.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Move this to a little function (which also has a better name now)
inside the already platform specific ossock.c
Also removing the EMSGSIZE check: we're using TCP or local unix
socket, so EMSGSIZE is never returned.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Yet another very internal function that the proprietary Nvidia driver
is using for unknown reasons.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Not needed by drivers (there aren't any on win32), so no need to
have it in public SDK header.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
It's only used by record extension, not used by any drivers at all
(neither FOSS nor proprietary), so it shouldn't be in the public SDK.
Since it's never been used by any driver, it's effectively no ABI change,
so we can safely do this within ABI-25.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Not used by any external drivers, so no need to keep them in public
SDK headers. Since they're never used by drivers, it's effectively
not an ABI change, so can safely be done within ABI-25.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Not used by any drivers, no no need to keep it in public SDK.
Since it's not used by drivers, it's effectively not an ABI change,
so can be done within ABI-25.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
these symbols aren't used by any external drivers (not even proprietary
Nvidia), so no need to keep them exported any longer:
* present_check_flips
* present_register_complete_notify
* present_can_window_flip
* uint32_t FakeScreenFps
Since it's not any *effective* ABI change, can go into current ABI-25 line.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Only used inside OS layer and xfree86 os-support, so no need to keep
it in public SDK.
Since never used by any drivers, it's not an actual ABI change, so
we can safely do it within ABI-25.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Not exported, not used by any external modules, so no need to have
that declaration in a public SDK header.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> ../os/Xtranssock.c:494:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
> 494 | strncpy(addr->sa_data, port, portlen);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../os/Xtranssock.c:446:15: note: length computed here
> 446 | portlen = strlen(port) + 1; // include space for trailing null
> | ^~~~~~~~~~~~
Since we already know the string length, we can just use memcpy()
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>