blob: 5e1877c6e56d33687f1d0c5d18a9ef1edb6389ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/*
** Copyright 1998 - 1999 Double Precision, Inc.
** See COPYING for distribution information.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include "maildirquota.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
static const char rcsid[]="$Id: overquota.c,v 1.0 2002/06/09 16:21:05 mr \
sam Exp $";
int user_over_maildirquota( const char *dir, const char *q)
{
struct stat stat_buf;
int quotafd;
int ret_value;
if (fstat(0, &stat_buf) == 0 && S_ISREG(stat_buf.st_mode) &&
stat_buf.st_size > 0 && *q)
{
if (maildir_checkquota(dir, "afd, q, stat_buf.st_size, 1)
&& errno != EAGAIN)
{
if (quotafd >= 0) close(quotafd);
ret_value = 1;
} else {
maildir_addquota(dir, quotafd, q, stat_buf.st_size, 1);
if (quotafd >= 0) close(quotafd);
ret_value = 0;
}
} else {
ret_value = 0;
}
return(ret_value);
}
|