diff options
author | Mattias Andrée <maandree@kth.se> | 2020-04-30 16:35:07 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2020-04-30 16:35:07 +0200 |
commit | acbce2643ea1e4c79d3d8acdf37cfd7329a2f12e (patch) | |
tree | 3126e5327d230ad0c2ee43bc668d09d924ddc9ff /libskrift_open_font_at.c | |
parent | reverse_text: use restrict (diff) | |
download | libskrift-acbce2643ea1e4c79d3d8acdf37cfd7329a2f12e.tar.gz libskrift-acbce2643ea1e4c79d3d8acdf37cfd7329a2f12e.tar.bz2 libskrift-acbce2643ea1e4c79d3d8acdf37cfd7329a2f12e.tar.xz |
Add libskrift_open_font_at
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libskrift_open_font_at.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libskrift_open_font_at.c b/libskrift_open_font_at.c new file mode 100644 index 0000000..2927dea --- /dev/null +++ b/libskrift_open_font_at.c @@ -0,0 +1,18 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + +int +libskrift_open_font_at(LIBSKRIFT_FONT **fontp, int dirfd, const char *path) +{ + int fd, ret; + if (!*path) { + return libskrift_open_font_fd(fontp, dirfd); + } else { + fd = openat(dirfd, path, O_RDONLY); + if (fd < 0) + return -1; + ret = libskrift_open_font_fd(fontp, fd); + close(fd); + return ret; + } +} |