diff options
author | Karel Zak | 2017-10-23 15:45:01 +0200 |
---|---|---|
committer | Karel Zak | 2017-10-23 15:45:01 +0200 |
commit | d182565be1515926c8eeda81452a4746d8b2a63d (patch) | |
tree | 769ed4e44a721df186185353234e56eb745fb18e /lib | |
parent | lib/signames: fix redefinition of 'sys_signame' on OSX (diff) | |
download | kernel-qcow2-util-linux-d182565be1515926c8eeda81452a4746d8b2a63d.tar.gz kernel-qcow2-util-linux-d182565be1515926c8eeda81452a4746d8b2a63d.tar.xz kernel-qcow2-util-linux-d182565be1515926c8eeda81452a4746d8b2a63d.zip |
lib/path: make path_set_prefix() independent on cpu_set_t
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/path.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/path.c b/lib/path.c index 79c1e7a68..e8cfa557a 100644 --- a/lib/path.c +++ b/lib/path.c @@ -35,6 +35,20 @@ static size_t prefixlen; static char pathbuf[PATH_MAX]; +int +path_set_prefix(const char *prefix) +{ + size_t len = strlen(prefix); + + if (len >= sizeof(pathbuf) - 1) { + errno = ENAMETOOLONG; + return -1; + } + prefixlen = len; + strcpy(pathbuf, prefix); + return 0; +} + static const char * path_vcreate(const char *path, va_list ap) { @@ -259,19 +273,4 @@ path_read_cpulist(int maxcpus, const char *path, ...) return set; } - -int -path_set_prefix(const char *prefix) -{ - size_t len = strlen(prefix); - - if (len >= sizeof(pathbuf) - 1) { - errno = ENAMETOOLONG; - return -1; - } - prefixlen = len; - strcpy(pathbuf, prefix); - return 0; -} - #endif /* HAVE_CPU_SET_T */ |