1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
lvm2/lib/misc/lvm-string.h

32 lines
506 B
C
Raw Normal View History

/*
* Copyright (C) 2001 Sistina Software (UK) Limited.
*
* This file is released under the LGPL.
*/
#ifndef _LVM_STRING_H
#define _LVM_STRING_H
#include <stdarg.h>
/*
* Different versions of glibc have different
* return values for over full buffers.
*/
static inline int lvm_snprintf(char *str, size_t size, const char *format, ...)
{
int n;
va_list ap;
va_start(ap, format);
n = vsnprintf(str, size, format, ap);
va_end(ap);
2001-12-20 14:52:54 +03:00
if (n < 0 || (n == size))
return -1;
return n;
}
#endif