]> git.pld-linux.org Git - packages/chntpw.git/blob - chntpw-080526-correct-test-for-failing-open-syscall.patch
patch Makefile for our optflags
[packages/chntpw.git] / chntpw-080526-correct-test-for-failing-open-syscall.patch
1 From jim@meyering.net  Mon Jul 20 20:05:55 2009
2 Return-Path: jim@meyering.net
3 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on amd.home.annexia.org
4 X-Spam-Level: 
5 X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,
6         UNPARSEABLE_RELAY autolearn=ham version=3.2.5
7 Received: from mail.corp.redhat.com [10.5.5.51]
8         by amd.home.annexia.org with IMAP (fetchmail-6.3.8)
9         for <rjones@localhost> (single-drop); Mon, 20 Jul 2009 20:05:55 +0100 (BST)
10 Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO
11  zmta03.collab.prod.int.phx2.redhat.com) (10.5.5.33) by
12  mail06.corp.redhat.com with LMTP; Mon, 20 Jul 2009 15:05:47 -0400 (EDT)
13 Received: from localhost (localhost.localdomain [127.0.0.1])
14         by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 2C1134E4EB
15         for <rjones@redhat.com>; Mon, 20 Jul 2009 15:05:47 -0400 (EDT)
16 Received: from zmta03.collab.prod.int.phx2.redhat.com ([127.0.0.1])
17         by localhost (zmta03.collab.prod.int.phx2.redhat.com [127.0.0.1]) (amavisd-new, port 10024)
18         with ESMTP id a7N9dvNRkYQB for <rjones@redhat.com>;
19         Mon, 20 Jul 2009 15:05:47 -0400 (EDT)
20 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26])
21         by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 034384E4D6
22         for <rjones@mail.corp.redhat.com>; Mon, 20 Jul 2009 15:05:46 -0400 (EDT)
23 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199])
24         by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6KJ5kIt032703
25         for <rjones@int-mx2.corp.redhat.com>; Mon, 20 Jul 2009 15:05:46 -0400
26 Received: from mx.meyering.net (sebastian-int.corp.redhat.com [172.16.52.221])
27         by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6KJ5jf3021050
28         for <rjones@redhat.com>; Mon, 20 Jul 2009 15:05:45 -0400
29 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000)
30         id D674638154; Mon, 20 Jul 2009 21:05:44 +0200 (CEST)
31 From: Jim Meyering <jim@meyering.net>
32 To: "Richard W. M. Jones" <rjones@redhat.com>
33 Subject: chntpw [PATCH] correct test for failing "open" syscall
34 Date: Mon, 20 Jul 2009 21:05:44 +0200
35 Message-ID: <878wij899z.fsf@meyering.net>
36 MIME-Version: 1.0
37 Content-Type: text/plain; charset=us-ascii
38 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26
39 Status: RO
40 Content-Length: 1103
41 Lines: 33
42
43 This one is weird.
44 It must be code that is never exercised,
45 since the existing code is totally bogus.
46 The condition, !open(...), will almost always be true.
47 (sole exception is when starting a program with stdin
48 initially closed)
49
50 >From bc4cddb06cf13c189fbdc93e6962cad072779097 Mon Sep 17 00:00:00 2001
51 From: Jim Meyering <meyering@redhat.com>
52 Date: Mon, 20 Jul 2009 14:59:19 -0400
53 Subject: [PATCH] correct test for failing "open" syscall
54
55 * ntreg.c (writeHive): Test open() < 0, not !open().
56 ---
57  ntreg.c |    2 +-
58  1 files changed, 1 insertions(+), 1 deletions(-)
59
60 diff --git a/ntreg.c b/ntreg.c
61 index be6b680..21cd3e3 100644
62 --- a/ntreg.c
63 +++ b/ntreg.c
64 @@ -2765,7 +2765,7 @@ int writeHive(struct hive *hdesc)
65    if ( !(hdesc->state & HMODE_DIRTY)) return(0);
66
67    if ( !(hdesc->state & HMODE_OPEN)) { /* File has been closed */
68 -    if (!(hdesc->filedesc = open(hdesc->filename,O_RDWR))) {
69 +    if ((hdesc->filedesc = open(hdesc->filename,O_RDWR)) < 0) {
70        fprintf(stderr,"writeHive: open(%s) failed: %s, FILE NOT WRITTEN!\n",hdesc->filename,strerror(errno));
71        return(1);
72      }
73 -- 
74 1.6.2.5
75
This page took 0.076938 seconds and 3 git commands to generate.