Bug 630093 - fix coverity Defect Type: Uninitialized variables issues
Summary: fix coverity Defect Type: Uninitialized variables issues
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Directory Server
Version: 1.2.6
Hardware: All
OS: Linux
high
medium
Target Milestone: ---
Assignee: Nathan Kinder
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks: 639035
TreeView+ depends on / blocked
 
Reported: 2010-09-03 17:15 UTC by Nathan Kinder
Modified: 2015-12-07 17:18 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-07 17:18:08 UTC
Embargoed:


Attachments (Terms of Use)
Patch for cov#15511 (9.27 KB, patch)
2010-09-08 15:33 UTC, Nathan Kinder
nhosoi: review+
nkinder: review?
Details | Diff
Patch for cov#15518 (1.47 KB, patch)
2010-09-08 15:55 UTC, Nathan Kinder
no flags Details | Diff
Patch for cov#15518 (1.93 KB, patch)
2010-09-08 16:58 UTC, Nathan Kinder
nhosoi: review+
nkinder: review?
Details | Diff

Description Nathan Kinder 2010-09-03 17:15:28 UTC
fix coverity Defect Type: Memory - Uninitialized variables issues

Comment 2 Nathan Kinder 2010-09-08 15:33:48 UTC
Created attachment 446014 [details]
Patch for cov#15511

Comment 3 Nathan Kinder 2010-09-08 15:55:07 UTC
Created attachment 446023 [details]
Patch for cov#15518

Comment 4 Noriko Hosoi 2010-09-08 16:36:17 UTC
(In reply to comment #3)
> Created attachment 446023 [details]
> Patch for cov#15518

I'm sure it won't happen, but could you check fd with 3 instead of 0?  (we want to clearly say we won't close STDIN and STDERR... :)
-    if (fd != FD_STDOUT) {
+    if ((fd >= 0) && (fd != FD_STDOUT)) { 
                ^
                3

Then, we don't need to check with FD_STDOUT...

Probably, we want to do "if (fd > STDERR_FILENO)"?  STDERR_FILENO is defined in unistd.h which is included in back-ldbm.h.

Also, instead of defining a macro in the file, we may want to use STDOUT_FILENO...
ldap/servers/slapd/back-ldbm/ldif2ldbm.c
 888 #define FD_STDOUT 1
 889

Comment 5 Nathan Kinder 2010-09-08 16:58:52 UTC
Created attachment 446044 [details]
Patch for cov#15518

Comment 6 Nathan Kinder 2010-09-08 17:29:48 UTC
Pushed patches to master.  Thanks to Noriko for her reviews!

Counting objects: 23, done.
Delta compression using 2 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 2.12 KiB, done.
Total 14 (delta 9), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   44e10f3..cd99e19  master -> master

Comment 7 Amita Sharma 2011-05-13 07:01:41 UTC
Coverity Related, Can I request Dev to test this.


Note You need to log in before you can comment on or make changes to this bug.