ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.c
(Generate patch)

Comparing libeio/eio.c (file contents):
Revision 1.157 by root, Thu Nov 29 21:48:44 2018 UTC vs.
Revision 1.158 by root, Mon Mar 18 23:52:09 2019 UTC

1/* 1/*
2 * libeio implementation 2 * libeio implementation
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2016,2017,2018 Marc Alexander Lehmann <libeio@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2016,2017,2018,2019 Marc Alexander Lehmann <libeio@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
1679 return EIO_INVALID_WD; 1679 return EIO_INVALID_WD;
1680 1680
1681#if HAVE_AT 1681#if HAVE_AT
1682 fd = openat (WD2FD (wd), path, O_CLOEXEC | O_SEARCH | O_DIRECTORY | O_NONBLOCK); 1682 fd = openat (WD2FD (wd), path, O_CLOEXEC | O_SEARCH | O_DIRECTORY | O_NONBLOCK);
1683 1683
1684 /* 0 is a valid fd, but we use it for EIO_CWD, so in the very unlikely */
1685 /* case of fd 0 being available (almost certainly an a pplication bug) */
1686 /* make sure we use another fd value */
1687 #if EIO_CWD
1688 error EIO_CWD must be 0
1689 #endif
1690 if (ecb_expect_false (fd == 0))
1691 {
1692 int fd2 = fcntl (fd, F_DUPFD_CLOEXEC ? F_DUPFD_CLOEXEC : F_DUPFD);
1693 fcntl (fd2, F_SETFD, FD_CLOEXEC);
1694 eio__close (fd);
1695 fd = fd2;
1696 }
1697
1684 if (fd < 0) 1698 if (fd < 0)
1685 return EIO_INVALID_WD; 1699 return EIO_INVALID_WD;
1686#endif 1700#endif
1687 1701
1688 res = malloc (sizeof (*res) + len); /* one extra 0-byte */ 1702 res = malloc (sizeof (*res) + len); /* one extra 0-byte */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines