Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath
Commits
823498d2
Commit
823498d2
authored
Aug 29, 2013
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openat is varargish
parent
a83c59af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
14 deletions
+42
-14
longpath.h
src/include/longpath/longpath.h
+2
-2
longpath.c
src/longpath.c
+40
-12
No files found.
src/include/longpath/longpath.h
View file @
823498d2
...
...
@@ -245,7 +245,7 @@ extern int utimel(const char *, const struct utimbuf *);
/* at funcs */
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
defined(_ATFILE_SOURCE)
extern
int
openatl
(
int
,
const
char
*
,
int
,
mode_t
);
extern
int
openatl
(
int
,
const
char
*
,
int
,
...
);
#ifdef HAVE_ATTROPEN
extern
int
attropenl
(
const
char
*
,
const
char
*
,
int
,
...);
#endif
...
...
@@ -321,7 +321,7 @@ extern int statl64(const char *, struct stat64 *);
/* 64 at funcs */
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
defined(_ATFILE_SOURCE)
extern
int
openatl64
(
int
,
const
char
*
,
int
,
mode_t
);
extern
int
openatl64
(
int
,
const
char
*
,
int
,
...
);
#ifdef HAVE_ATTROPEN
extern
int
attropenl64
(
const
char
*
,
const
char
*
,
int
,
...);
#endif
...
...
src/longpath.c
View file @
823498d2
...
...
@@ -113,6 +113,12 @@
#include <sys/xattr.h>
#endif
static
int
_openatl
(
int
,
const
char
*
,
int
,
mode_t
mode
);
#if !defined(_LP64)
static
int
_openatl64
(
int
,
const
char
*
,
int
,
mode_t
mode
);
#endif
/*
* close an intermediate file descriptor, restoring errno if necessary
*/
...
...
@@ -295,8 +301,8 @@ oatl_im(int filedes, const char *path, const char **remaining) {
#define Xfl(path, flags, err, r, funcn, ...) \
int __ifd; \
\
__ifd =
openatl(AT_FDCWD, (path),
\
O_RDONLY|O_NDELAY|O_LARGEFILE
, (flags)
); \
__ifd =
six4(_openatl)(AT_FDCWD, (path),
\
O_RDONLY|O_NDELAY|O_LARGEFILE
|(flags), 0
); \
\
if (__ifd == -1) \
return (err); \
...
...
@@ -306,18 +312,41 @@ oatl_im(int filedes, const char *path, const char **remaining) {
close_ifd(__ifd)
/* OPEN */
int
openatl
(
int
filedes
,
const
char
*
path
,
int
oflag
,
mode_t
mode
)
{
static
int
_
openatl
(
int
filedes
,
const
char
*
path
,
int
oflag
,
mode_t
mode
)
{
Xatl
(
openat
,
filedes
,
path
,
oflag
,
mode
);
}
#if !defined(_LP64)
int
openatl64
(
int
filedes
,
const
char
*
path
,
int
oflag
,
mode_t
mode
)
{
static
int
_
openatl64
(
int
filedes
,
const
char
*
path
,
int
oflag
,
mode_t
mode
)
{
Xatl
(
openat64
,
filedes
,
path
,
oflag
,
mode
);
}
#endif
#define Openatl(bits) \
mode_t mode = 0; \
if (oflag & O_CREAT) { \
va_list arg; \
va_start(arg, oflag); \
mode = va_arg(arg, mode_t); \
va_end(arg); \
} \
\
return _openatl ## bits (filedes, path, oflag, mode)
int
openatl
(
int
filedes
,
const
char
*
path
,
int
oflag
,
...)
{
Openatl
(
/*32*/
);
}
#if !defined(_LP64)
int
openatl64
(
int
filedes
,
const
char
*
path
,
int
oflag
,
...)
{
Openatl
(
64
);
}
#endif
#define Openl(bits) \
mode_t mode = 0; \
if (oflag & O_CREAT) { \
...
...
@@ -327,7 +356,7 @@ openatl64(int filedes, const char *path, int oflag, mode_t mode) {
va_end(arg); \
} \
\
return openatl ## bits (AT_FDCWD, path, oflag, mode)
return
_
openatl ## bits (AT_FDCWD, path, oflag, mode)
int
...
...
@@ -345,12 +374,12 @@ openl64(const char *path, int oflag, ...) {
int
creatl
(
const
char
*
path
,
mode_t
mode
)
{
return
openatl
(
AT_FDCWD
,
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
mode
);
return
_
openatl
(
AT_FDCWD
,
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
mode
);
}
#if !defined(_LP64)
int
creatl64
(
const
char
*
path
,
mode_t
mode
)
{
return
openatl64
(
AT_FDCWD
,
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
mode
);
return
_
openatl64
(
AT_FDCWD
,
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
mode
);
}
#endif
...
...
@@ -367,7 +396,7 @@ creatl64(const char *path, mode_t mode) {
return -1; \
\
va_start(ap, oflag); \
afd = openatl ## bits (fd, apath, oflag|O_XATTR, \
afd =
_
openatl ## bits (fd, apath, oflag|O_XATTR, \
va_arg(ap, mode_t)); \
va_end(ap); \
\
...
...
@@ -1115,10 +1144,9 @@ utimel(const char *path, const struct utimbuf *times) {
/* OPENDIR */
DIR
*
opendirl
(
const
char
*
dirname
)
{
DIR
*
r
;
int
fd
;
/* almost identical to Xfl, but we must not close the fd */
fd
=
openatl
(
AT_FDCWD
,
dirname
,
O_RDONLY
|
O_NDELAY
|
O_LARGEFILE
,
0
);
fd
=
_
openatl
(
AT_FDCWD
,
dirname
,
O_RDONLY
|
O_NDELAY
|
O_LARGEFILE
,
0
);
if
(
fd
==
-
1
)
return
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment