Re: fork() Problem?

Kurt Garloff (garloff@suse.de)
Wed, 5 May 1999 21:46:00 +0200


--DocE+STaALJfprDB
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

On Wed, May 05, 1999 at 09:52:23AM -0400, Richard B. Johnson wrote:

> > if (pid =3D fork())
> ^^^^________ logical test of an assignment? This will always
> be true!
> if((pid =3D fork()) !=3D 0) or
> if((pid =3D fork()))=20
> You need to make the assignment first, then
> test for non-zero. =20

SORRY? I can't let this uncorrected!

Why do you think it's legal to use smth like a =3D b =3D c; ???

Because b =3D c return the value assigned to b.

if (pid =3D fork()) do_smth;

is identical to
=20
if ((pid =3D fork()) !=3D 0) do_smth;
=20

--=20
Kurt Garloff <garloff@suse.de> SuSE GmbH, N=FCrnberg, FRG
Linux kernel development; SCSI driver: DC390 (tmscsim/AM53C974)

--DocE+STaALJfprDB
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3in

iQCVAwUBNzCf+BaQN/7O/JIVAQHYJwP+Ok1zIW+zFFPlvX0DsKqlsiml2cqU5kRE
+u4BYMgAztmKVgo70e61Z/Lgs3dPQL+hD2BPRUJdPB3FXJqdzm9U5nfBs4TRlEfg
IAHESh7tWw8KNJVRnwUSzYCBmoWR6g0cuwrZL5qcu7jQeXZZDqBRBfsvNeZeGWcf
krgsPtx8IvY=
=uBSV
-----END PGP SIGNATURE-----

--DocE+STaALJfprDB--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/