tags 649689 +pending -patch
thanks

On Wed, Nov 23, 2011 at 09:44:34AM +0100, Svante Signell wrote:
> The attached patch fixes the FTBFS problems for GNU/Hurd due to the lack
> of a PATH_MAX definition. Instead of fixed length strings dynamic
> allocation is used.  

I fixed this problem a different way.  See below.

> Additionally, the call to msync() is made conditional on HAVE_MSYNC
> instead of MS_SYNC by a test in configure.in for that function. On
> GNU/Hurd msync() is only a stub, so with this test a potential run-time
> error is avoided.

I'll take care of this too --- but in the future I'd appreciate if you
submitted separate patches for separate fixes.

Thanks, regards

                                        - Ted

commit 4cd2d4ca4128456b82e927b1efd2dd023100934e
Author: Theodore Ts'o <ty...@mit.edu>
Date:   Sun Nov 27 20:31:36 2011 -0500

    libquota: remove use of PATH_MAX and replace it with QUOTA_NAME_LEN
    
    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" <ty...@mit.edu>

diff --git a/lib/quota/mkquota.h b/lib/quota/mkquota.h
index 4fbaedd..a5fa74b 100644
--- a/lib/quota/mkquota.h
+++ b/lib/quota/mkquota.h
@@ -60,9 +60,4 @@ int quota_is_on(ext2_filsys fs, int type);
 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__ */
diff --git a/lib/quota/quotaio.c b/lib/quota/quotaio.c
index d0b5b9d..3f434ca 100644
--- a/lib/quota/quotaio.c
+++ b/lib/quota/quotaio.c
@@ -56,7 +56,7 @@ const char *quota_get_qf_name(int type, int fmt, char *buf)
 {
        if (!buf)
                return NULL;
-       snprintf(buf, PATH_MAX, "%s.%s",
+       snprintf(buf, QUOTA_NAME_LEN, "%s.%s",
                 basenames[fmt], extensions[type]);
 
        return buf;
@@ -66,7 +66,7 @@ const char *quota_get_qf_path(const char *mntpt, int qtype, 
int fmt,
                              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;
diff --git a/lib/quota/quotaio.h b/lib/quota/quotaio.h
index f8cc1f1..91a1ff2 100644
--- a/lib/quota/quotaio.h
+++ b/lib/quota/quotaio.h
@@ -159,4 +159,12 @@ const char *type2name(int type);
 
 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 */



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to