Mark system headers with SYSTEM keyword

(cherry picked from commit 1377d3de993d37594532c4cca5e883596727590b)
Only -1 returned by open() means "unsuccessful completion"
Coverity CID 1034535, CID 1127333

(cherry picked from commit f07040f3a472763d4b289f0319a60a69c301db05)
We will leak descriptor after goto
Coverity CID 1127332, CID 1127333

(cherry picked from commit d0c08b1cb869c335fbe2e6c0a1083fa46257a3e9)
Use unmodified width/height orientation.

(cherry picked from commit 8341df8697bdc128a47bf4efcda0def84e97a31d)