On Pá, 2014-08-15 at 21:09 +0200, Robin Hack wrote:
Sorry for broken subject.
On Fri, Aug 15, 2014 at 09:05:52PM +0200, Robin Hack wrote:
> From 44980f0ef942edf52e73cad1dacc08b507c3a535 Mon Sep 17 00:00:00 2001
> From: Robin Hack <rhack(a)redhat.com>
> Date: Fri, 15 Aug 2014 18:44:56 +0200
> Subject: [PATCH 3/3] pam_mkhomedir: Code flow fix.
>
> Fixed code:
> if ((srcfd = open(newsource, O_RDONLY)) < 0 || fstat(srcfd, &st) != 0)
>
> When open() call fails then srcfd is rewriten by -1. So call fstat() on descriptor
-1 after
> have no much sense.
This is not a bug at all.
If the first condition of the boolean || operator is evaluated to true,
that is the srcfd is -1, the second condition is not evaluated at all so
fstat() is not called in case srcfd is < 0.
--
Tomas Mraz
No matter how far down the wrong road you've gone, turn back.
Turkish proverb
(You'll never know whether the road is wrong though.)