Sophie

Sophie

distrib > Mageia > 8 > aarch64 > by-pkgid > 77ea68a930337ddaa524a84012be201c > files > 1

chntpw-1.0-5.mga8.src.rpm

Fix code that probably is never run since the existing code is totally bogus.
The condition, !open(...), will almost always be true.
(sole exception is when starting a program with stdin
initially closed)

--- a/ntreg.c
+++ b/ntreg.c
@@ -4133,7 +4133,7 @@
   if ( !(hdesc->state & HMODE_DIRTY)) return(0);
 
   if ( !(hdesc->state & HMODE_OPEN)) { /* File has been closed */
-    if (!(hdesc->filedesc = open(hdesc->filename,O_RDWR))) {
+    if ((hdesc->filedesc = open(hdesc->filename,O_RDWR)) < 0) {
       fprintf(stderr,"writeHive: open(%s) failed: %s, FILE NOT WRITTEN!\n",hdesc->filename,strerror(errno));
       return(1);
     }