Changeset ec18957a in mainline for uspace/lib/posix/sys/stat.c


Ignore:
Timestamp:
2011-07-08T00:54:24Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c1984f
Parents:
3f466c33
Message:

Added errno.h (see commentary inside).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/sys/stat.c

    r3f466c33 rec18957a  
    3939#include "stat.h"
    4040
     41#include "../errno.h"
    4142#include "../libc/mem.h"
    4243
     
    7677{
    7778        struct stat hst;
    78         if (fstat(fd, &hst) == -1) {
    79                 // TODO: propagate a POSIX compatible errno
     79        int rc = fstat(fd, &hst);
     80        if (rc < 0) {
     81                /* fstat() returns negative error code instead of using errno.
     82                 */
     83                errno = -rc;
    8084                return -1;
    8185        }
     
    107111{
    108112        struct stat hst;
    109         if (stat(path, &hst) == -1) {
    110                 // TODO: propagate a POSIX compatible errno
     113        int rc = stat(path, &hst);
     114        if (rc < 0) {
     115                /* stat() returns negative error code instead of using errno.
     116                 */
     117                errno = -rc;
    111118                return -1;
    112119        }
Note: See TracChangeset for help on using the changeset viewer.