PATH_MAX is not portable (for example, it doesn't exist on the Hurd).
So replace it with a new define, which defines the maximum length of
the base quota name. As it turns out, this is substantially smaller
than PATH_MAX.
Also move the definitions relating to quotaio.c from mkquota.h to
quotaio.h, as a cleanup.
Addresses-Debian-Bug: #649689
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
#include "e2fsck.h"
#include "problem.h"
#include "quota/mkquota.h"
+#include "quota/quotaio.h"
static void move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino,
ext2_ino_t to_ino, int qtype)
ext2_ino_t ino;
struct ext2_inode inode;
errcode_t retval;
- char qf_name[255];
+ char qf_name[QUOTA_NAME_LEN];
if (ext2fs_read_inode(fs, from_ino, &inode))
return;
int quota_file_exists(ext2_filsys fs, int qtype, int fmt);
void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, int qtype);
-/* In quotaio.c */
-const char *quota_get_qf_name(int type, int fmt, char *buf);
-const char *quota_get_qf_path(const char *mntpt, int qtype, int fmt,
- char *path_buf, size_t path_buf_size);
-
#endif /* __QUOTA_QUOTAIO_H__ */
{
if (!buf)
return NULL;
- snprintf(buf, PATH_MAX, "%s.%s",
+ snprintf(buf, QUOTA_NAME_LEN, "%s.%s",
basenames[fmt], extensions[type]);
return buf;
char *path_buf, size_t path_buf_size)
{
struct stat qf_stat;
- char qf_name[PATH_MAX] = {0};
+ char qf_name[QUOTA_NAME_LEN];
if (!mntpt || !path_buf || !path_buf_size)
return NULL;
void update_grace_times(struct dquot *q);
+/* size for the buffer returned by quota_get_qf_name(); must be greater
+ than maxlen of extensions[] and fmtnames[] (plus 2) found in quotaio.c */
+#define QUOTA_NAME_LEN 16
+
+const char *quota_get_qf_name(int type, int fmt, char *buf);
+const char *quota_get_qf_path(const char *mntpt, int qtype, int fmt,
+ char *path_buf, size_t path_buf_size);
+
#endif /* GUARD_QUOTAIO_H */