On 09/07/12 13:55, ольга крыжановская wrote:
Roger, http://www.gnu.org/software/gnulib/manual/html_node/fcntl_002eh.html
says that "* ‘AT_FDCWD’ is defined with a value too large for an int
on some platforms: Solaris 11 2010-11."
Solaris 11/B145 does a '#define AT_FDCWD 0xffd19553'. Is this value
not unsigned by default?

Olga

The value 0xffd19553 was an unfortunate choice, made in July, 2001,
when the code that included openat(), was introduced into Solaris 9.

Depending on the compiler and the specific code usage,
this can draw a warning.  For example:

        int fd = AT_FDCWD;
draws this from the Studio compiler:
"x.c", line 6: warning: initializer does not fit or is out of range: 0xffd19553

but the following uses draw no warnings:
        int fd;
        fd = AT_FDCWD;
        fd = openat(AT_FDCWD, "motd", O_RDONLY);
        if (fd == AT_FDCWD)
                return (-1);

The #define could be changed to this while maintaining the same bit pattern
and the warnings would disappear:

        #define AT_FDCWD (-3041965)

but I don't know if this issue is serious enough to warrant the change.
The one offending line could be changed to eliminate the warning:

        int fd = (int)AT_FDCWD;

In any case, this is certainly not a security problem, so
     security-disc...@opensolaris.org
should be dropped from the discussion.

Roger

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to