Project

General

Profile

Actions

Bug #1630

closed

Bug #1450: Illumos should be buildable with GCC4

quota(1M) relies on undefined operation order

Added by Rich Lowe almost 11 years ago. Updated almost 11 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:
Gerrit CR:
External Bug:

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;
Actions

Also available in: Atom PDF