mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
s3/vfs_glusterfs_fuse: Avoid using NAME_MAX directly
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13872 Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Tue Jun 11 00:29:19 UTC 2019 on sn-devel-184
This commit is contained in:
parent
e85bb58532
commit
7cc9e3fe24
@ -21,6 +21,8 @@
|
||||
#include "smbd/smbd.h"
|
||||
#include "system/filesys.h"
|
||||
|
||||
#define GLUSTER_NAME_MAX 255
|
||||
|
||||
static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle,
|
||||
const char *path,
|
||||
const char *name,
|
||||
@ -28,19 +30,19 @@ static int vfs_gluster_fuse_get_real_filename(struct vfs_handle_struct *handle,
|
||||
char **_found_name)
|
||||
{
|
||||
int ret;
|
||||
char key_buf[NAME_MAX + 64];
|
||||
char val_buf[NAME_MAX + 1];
|
||||
char key_buf[GLUSTER_NAME_MAX + 64];
|
||||
char val_buf[GLUSTER_NAME_MAX + 1];
|
||||
char *found_name = NULL;
|
||||
|
||||
if (strlen(name) >= NAME_MAX) {
|
||||
if (strlen(name) >= GLUSTER_NAME_MAX) {
|
||||
errno = ENAMETOOLONG;
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(key_buf, NAME_MAX + 64,
|
||||
snprintf(key_buf, GLUSTER_NAME_MAX + 64,
|
||||
"glusterfs.get_real_filename:%s", name);
|
||||
|
||||
ret = getxattr(path, key_buf, val_buf, NAME_MAX + 1);
|
||||
ret = getxattr(path, key_buf, val_buf, GLUSTER_NAME_MAX + 1);
|
||||
if (ret == -1) {
|
||||
if (errno == ENOATTR) {
|
||||
errno = EOPNOTSUPP;
|
||||
|
Loading…
x
Reference in New Issue
Block a user