Changeset 4e6a610 in mainline for uspace/lib/posix/src/unistd.c


Ignore:
Timestamp:
2018-06-25T09:54:28Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bfe90b6
Parents:
fb0ec570
git-author:
Jiri Svoboda <jiri@…> (2018-06-24 17:51:54)
git-committer:
Jiri Svoboda <jiri@…> (2018-06-25 09:54:28)
Message:

Temporary file functions rework. Fix libposix access() not working on directories.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/src/unistd.c

    rfb0ec570 r4e6a610  
    3939#include <errno.h>
    4040
     41#include "posix/dirent.h"
    4142#include "posix/string.h"
     43#include "posix/sys/types.h"
    4244#include "posix/fcntl.h"
    4345
     
    368370                 */
    369371                int fd = open(path, O_RDONLY);
    370                 if (fd < 0)
    371                         return -1;
    372                 close(fd);
    373                 return 0;
     372                if (fd >= 0) {
     373                        close(fd);
     374                        return 0;
     375                }
     376                DIR *dir = opendir(path);
     377                if (dir != NULL) {
     378                        closedir(dir);
     379                        return 0;
     380                }
     381                return -1;
    374382        } else {
    375383                /* Invalid amode argument. */
Note: See TracChangeset for help on using the changeset viewer.