f93cf255d4
Closes #238 Update all files to list SPDX license shortname. Most files are BSD 3 clause license. The exceptions are: serge@sl ~/src/shadow$ git grep SPDX-License | grep -v BSD-3-Clause contrib/atudel:# SPDX-License-Identifier: BSD-4-Clause lib/tcbfuncs.c: * SPDX-License-Identifier: 0BSD libmisc/salt.c: * SPDX-License-Identifier: Unlicense src/login_nopam.c: * SPDX-License-Identifier: Unlicense src/nologin.c: * SPDX-License-Identifier: BSD-2-Clause src/vipw.c: * SPDX-License-Identifier: GPL-2.0-or-later Signed-off-by: Serge Hallyn <serge@hallyn.com>
48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
|
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz
|
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
|
* SPDX-FileCopyrightText: 2008 , Nicolas François
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ident "$Id$"
|
|
|
|
#if HAVE_ULIMIT_H
|
|
#include <ulimit.h>
|
|
#ifndef UL_SETFSIZE
|
|
#ifdef UL_SFILLIM
|
|
#define UL_SETFSIZE UL_SFILLIM
|
|
#else
|
|
#define UL_SETFSIZE 2
|
|
#endif
|
|
#endif
|
|
#elif HAVE_SYS_RESOURCE_H
|
|
#include <sys/time.h> /* for struct timeval on sunos4 */
|
|
/* XXX - is the above ok or should it be <time.h> on ultrix? */
|
|
#include <sys/resource.h>
|
|
#endif
|
|
#include "prototypes.h"
|
|
|
|
int set_filesize_limit (int blocks)
|
|
{
|
|
int ret = -1;
|
|
#if HAVE_ULIMIT_H
|
|
if (ulimit (UL_SETFSIZE, blocks) != -1) {
|
|
ret = 0;
|
|
}
|
|
#elif defined(RLIMIT_FSIZE)
|
|
struct rlimit rlimit_fsize;
|
|
|
|
rlimit_fsize.rlim_cur = 512L * blocks;
|
|
rlimit_fsize.rlim_max = rlimit_fsize.rlim_cur;
|
|
ret = setrlimit (RLIMIT_FSIZE, &rlimit_fsize);
|
|
#endif
|
|
|
|
return ret;
|
|
}
|
|
|