Commit Graph

106 Commits

Author SHA1 Message Date
Emmanuel Ledoux
f94ab0033b winpr-thread: better error message upon a failure of TestThreadExitThread 2015-05-22 19:17:30 +02:00
Emmanuel Ledoux
6f5de27081 winpr-thread:
- added the unit test: TestThreadExitThread
  - fix: ensure thread_list to be up to date before to call ExitThread()
  - possibly resolved: Problems with serial redirection #2389
2015-05-22 18:28:10 +02:00
Marc-André Moreau
b9c1cddc2e Merge pull request #2583 from bceverly/OpenBSD-cleanup
Two minor source code changes to remove warnings
2015-05-21 10:17:54 -04:00
Bryan Everly
a3a3efe31e Fixed mistake with bitwise operator in previous two commits 2015-05-20 12:17:05 -04:00
Bryan Everly
80af54b169 Moved thread code to OpenBSD only 2015-05-20 10:52:24 -04:00
Hardening
f8120919af Add checks for some XXX_New and XXX_Add functions
Based on PR #2616
2015-05-18 11:28:00 +02:00
Norbert Federa
1eff1a345e free can handle NULL perfectly fine 2015-05-11 09:07:39 +02:00
Norbert Federa
c77def3048 Fix unchecked CreateMutex calls 2015-05-07 13:27:49 +02:00
Bryan Everly
9865854f3c Simplified random byte stream generation code to use SSL RAND_bytes() and also eliminated two more compiler warnings. 2015-05-05 12:33:44 -04:00
Bernhard Miklautz
a8c44f15c0 winpr: small fixes and cleanups
Update the pull request and integrate the latest comments and
suggestions.

* TestLibrary*: fix typo in error message
* TestPipeCreateNamedPipeOverlapped: free possibly allocated memory
* smartcard_pcsc.c: format fix
* process.c: add missing NULL check
* MessageQueue.c: delete possibly initialized critical section on error
2015-04-08 11:34:37 +02:00
Bernhard Miklautz
850de59b55 winpr: add checks for *alloc
Add missing checks if memory allocation was successful. Also adapt
caller(s) when possible.
2015-04-08 11:34:37 +02:00
Armin Novak
b3ea02a777 Removed INVALID_HANDLE_VALUE from types not using it. 2015-03-31 15:18:45 +02:00
Armin Novak
afe8bd2a86 Fixed missing checks for invalid handle. 2015-03-31 15:18:45 +02:00
Bernhard Miklautz
1d7b3694a9 Integrate feedback from pull request (#2492)
* shell: add missing NULL checks
* thread: handle case where HAVE_EVENTFD_H isn't defined
* wlog: return NULL instead of 0
* wlog: use g_RootLog instead of WLog_GetRoot
  otherwise a new root might be initialized on uninit
* indentation and style fixes
2015-03-25 17:38:21 +01:00
Bernhard Miklautz
3c7662517c hardening
Start to add missing checks for:
* *alloc
* *_New
2015-03-25 17:38:21 +01:00
David FORT
52bd4469d9 Make handle operations static
This patch moves the handle operations in a static struct.
2015-03-16 10:31:26 +01:00
Armin Novak
9153af6a3e Using new handle cleanup structure 2015-03-11 17:57:01 +01:00
Armin Novak
465d8ec688 Using new handle cleanup structure 2015-03-11 17:57:01 +01:00
Bernhard Miklautz
582856d142 winpr/process: handle pids <= 0
TerminateProcess shouldn't call kill if the PID is <=0 because this has
unwanted effects (and is not what TerminateProcess should do):

* with PID == 0 any process in the same process group gets the signal
  sent
* with PID == -1 *every* processes that the running users has
  permissions to gets the signal sent
* with PID < -1 the process within the same process group and -PID gets
  the signal send

For more details see kill(2).
2015-02-09 14:07:14 +01:00
Emmanuel Ledoux
4aeaffa286 libwinpr: better indentation 2015-01-28 12:43:20 +01:00
Emmanuel Ledoux
ab4a744b08 libwinpr: attempt to fix TerminateThread(...).
The following sequence should not hang forever anymore: TerminateThread(thread, 0); WaitForSingleObject(thread, INFINTE);
2015-01-27 21:05:40 +01:00
Armin Novak
122d1c43f4 Prettiefied WLog messages. 2015-01-20 11:04:23 +01:00
Armin Novak
44904ad5d2 Fixed a race condition at thread creation
The thread structure was incorrectly updated after the thread
function was already running. This caused a race condition with
thread exiting. When the thread function returned before the structure
was correctly updated, the exit routine cleaned up the handle as
it was incorrectly marked not started.
2015-01-16 11:26:31 +01:00
Armin Novak
4d8c91b0fe Fixed missing declarations. 2014-12-07 01:15:49 +01:00
Armin Novak
8a6c4396b2 Fixed memory leak. 2014-12-07 01:04:30 +01:00
Marc-André Moreau
6ccce86140 Merge branch 'master' of github.com:FreeRDP/FreeRDP
Conflicts:
	winpr/libwinpr/thread/thread.c
2014-12-03 10:10:50 -05:00
Martin Haimberger
7897de057b fixed compiler warning 2014-12-02 00:36:46 -08:00
Martin Haimberger
fa6d551676 changed processhandle handling to new system 2014-12-02 00:08:10 -08:00
Martin Haimberger
128458d380 fixing memoryleak by introducing a nonehandle
In CreateProcess the non functional thread
handle was leaked.
2014-12-01 23:53:58 -08:00
Marc-André Moreau
0818846d7c winpr: fix build warnings 2014-11-21 15:12:49 -05:00
Marc-André Moreau
871339da88 Merge branch 'master' of github.com:awakecoding/FreeRDP
Conflicts:
	winpr/libwinpr/thread/thread.c
2014-11-20 11:51:18 -05:00
Marc-André Moreau
2afcac7838 libwinpr-thread: fix non-blocking internal pipe-based event on OS X 2014-11-20 11:48:02 -05:00
Armin Novak
7b9bf1a504 Fixed uninitialized variable. 2014-11-16 17:02:36 +01:00
Armin Novak
fb5d20f338 Fixed NULL pointer dereference. 2014-11-16 16:51:04 +01:00
Armin Novak
53450b6423 Checking setgid before calling initgroups now. 2014-11-16 15:59:26 +01:00
Armin Novak
51cb07b0f4 Fixed use after free. 2014-11-16 15:21:13 +01:00
Armin Novak
f5a78d9c98 Fixed use after free. 2014-11-16 14:44:30 +01:00
Armin Novak
2d7311b253 Fixed type of stack trace variables. 2014-11-11 21:00:03 +01:00
Marc-André Moreau
68ee5df7d9 winpr: fix build warnings 2014-11-11 11:21:34 -05:00
Armin Novak
5bf25fd87c Fixed missing includes and typo. 2014-10-27 11:45:39 +01:00
Armin Novak
8f98f28ce8 Fixed merge errors. 2014-10-27 11:39:02 +01:00
Armin Novak
a6eff65259 Fixed ExitThread, now running pthread_exit and setting event. 2014-10-27 11:28:13 +01:00
Armin Novak
02a4d77da1 Setting exited flag in TerminateThread now to allow setting return code. 2014-10-27 11:28:12 +01:00
Armin Novak
7ef2bd3ca0 Added joined flag. 2014-10-27 11:28:12 +01:00
Armin Novak
5122ce939a Added funcion name to debug messages.
Fixed setting of started flag for threads.
pthred_exit now used correct return value argument.
Return value now also set when terminating thread.
2014-10-27 11:23:18 +01:00
Armin Novak
56ae609943 Removed WaitForSingleObject in reset_event, joining thread when not allowed. 2014-10-27 11:23:17 +01:00
Armin Novak
8a352c6f63 Fixed thread cleanup, now saving state of started flag, setting event and
then cleaning up the thread resources.
2014-10-27 11:23:17 +01:00
Armin Novak
f80f5621ac Fixed thread handle cleanup, checking for resource cleanup now before resetting flags. 2014-10-27 11:23:17 +01:00
Armin Novak
8de2868281 Preferring exit code from ExitThread now over thread function return. 2014-10-27 11:23:16 +01:00
Armin Novak
3d7b65a430 Now using thread_launcher function to properly clean up thread resources at exit. 2014-10-27 11:23:15 +01:00