mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
39b633c1de
Could everyone please use this from now on.
32 lines
504 B
C
32 lines
504 B
C
/*
|
|
* 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);
|
|
|
|
if (n < 0 || n == size)
|
|
return -1;
|
|
|
|
return n;
|
|
}
|
|
|
|
#endif
|