Project

General

Profile

Bug #1630

Bug #1450: Illumos should be buildable with GCC4

quota(1M) relies on undefined operation order

Added by Rich Lowe almost 8 years ago. Updated almost 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2011-10-12
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:

Description

quota(1M) contains code like this:

                mntopt += strcspn(mntopt, "=");
                if (strncmp(++mntopt, my_zonename,
                     strcspn(mntopt, ",")) != 0)
                     continue;

GCC4 complains that the order of the operations on mntopt is undefined (whether it is incremented before or after it is passed to strcspn). It's easy to adjust this to equivalent code without the problem:

                mntopt += strcspn(mntopt, "=") + 1;
                if (strncmp(mntopt, my_zonename,
                     strcspn(mntopt, ",")) != 0)
                     continue;

History

#1

Updated by Rich Lowe almost 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 50 to 100

Resolved in r13490 commit:580776032e8f

Also available in: Atom PDF