Bug 110823

Summary: bad source code
Product: [Fedora] Fedora Reporter: d.binderman
Component: mtoolsAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-12-09 12:08:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description d.binderman 2003-11-24 17:09:11 UTC
Description of problem:

I just tried to compile package mtools-3_9_9-3 from Fedora.

The compiler said

1.

config.c(567): warning #187: use of "=" where "==" may have been 
intended
config.c(568): warning #187: use of "=" where "==" may have been 
intended
config.c(569): warning #187: use of "=" where "==" may have been 
intended
config.c(570): warning #187: use of "=" where "==" may have been 
intended

The source code is

    if((match_token("drive") && ((action = 1)))||
       (match_token("drive+") && ((action = 2))) ||
       (match_token("+drive") && ((action = 3))) ||
       (match_token("clear_drive") && ((action = 4))) ) {

You might be better off with 

    if((match_token("drive") && ((action == 1)))||
       (match_token("drive+") && ((action == 2))) ||
       (match_token("+drive") && ((action == 3))) ||
       (match_token("clear_drive") && ((action == 4))) ) {

But location variable "action" has the value 0 anyway.

2.

mformat.c(1102): warning #175: subscript out of range

The source code is

                set_word(boot->jump + 510, 0xaa55);

But
        unsigned char jump[3];          /* 0  Jump to boot code */

Not sure what might be better code here.


Version-Release number of selected component (if applicable):
mtools-3_9_9-3 

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Tim Waugh 2003-12-09 12:08:59 UTC
I think this code is as intended.  See the extra set of parentheses on
each test, and the larger picture of what the code is trying to do.