Remove the continuous warning about the unknown flow control

Task-number: QTBUG-36865

Change-Id: I332901ad0118f1176b0d3b8e45c8000f0dfb59ee
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Use the qt_safe_* methods for open/read/write/close

This makes the operation thread-safe. It also helps with preventing the leaks
for child processes. Also, there is now some protection against EINTR when the
system call has to be restarted.

Thanks go to Thiago Macieira for providing the original patches.

Task-number: QTBUG-36824

Change-Id: I90cac87c5e1c55a57e5ba6c20313446c43c6d242
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Use Q_GLOBAL_STATIC for the udev symbol loading QLibrary instance

Even though this has been introduced in 5.1, officially, we can rely on it in
the previous versions even if private API that it was.

* Global variables are better avoided.

* Q_GLOBAL_STATIC is thread-safe in Qt 5.

* QLibrary depends on QCoreApplication and we need to make sure that is
initialized afterwards, respectively.

The instantiation is now moved into the corresponding source file so that if it
is included at more than one place, it will not be instantiated each time it is
used in a new source file including this header.

Task-number: QTBUG-36870

Change-Id: I96de1257e5836b69d0c48b717d7c2e708d6b0fee
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Set error if the file buffer flushing fails on Windows

Change-Id: I58cf61540bc53e314988753a252cbc71003ce581
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Merge remote-tracking branch 'origin/stable' into dev

Change-Id: Ifff35473fe07ee5d94f9fb4f0125ee125c109c76