From bf4f4690f0f5519accae512021e132c7139058b8 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 20 Nov 2015 20:03:47 +0100 Subject: [PATCH] Fix #1449 about a FileDaemon segfault with the fstype option --- bacula/src/findlib/find.h | 2 +- bacula/src/findlib/fstype.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index a12bf036e4..4f98f9642c 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -212,7 +212,7 @@ struct FF_PKT { bool opt_plugin; /* set if we have an option plugin */ rblist *mtab_list; /* List of mtab entries */ uint64_t last_fstype; /* cache last file system type */ - char *last_fstypename; /* cache last file system type name */ + char last_fstypename[32]; /* cache last file system type name */ alist fstypes; /* allowed file system types */ alist drivetypes; /* allowed drive types */ alist mount_points; /* Possible mount points to be snapshotted */ diff --git a/bacula/src/findlib/fstype.c b/bacula/src/findlib/fstype.c index c2bc83d7d4..d90e5fd8ba 100644 --- a/bacula/src/findlib/fstype.c +++ b/bacula/src/findlib/fstype.c @@ -176,7 +176,7 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) if (statfs(fname, &st) == 0) { mtab_item *item, search_item; - if (ff_pkt->last_fstypename && ff_pkt->last_fstype == (uint64_t)st.f_type) { + if (*ff_pkt->last_fstypename && ff_pkt->last_fstype == (uint64_t)st.f_type) { bstrncpy(fs, ff_pkt->last_fstypename, fslen); return true; } @@ -188,7 +188,7 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) item = (mtab_item *)ff_pkt->mtab_list->search((void *)&search_item, compare_mtab_items); if (item) { ff_pkt->last_fstype = st.f_type; - bstrncpy(ff_pkt->last_fstypename, item->fstype, sizeof(ff_pkt->last_fstype)); + bstrncpy(ff_pkt->last_fstypename, item->fstype, sizeof(ff_pkt->last_fstypename)); bstrncpy(fs, ff_pkt->last_fstypename, fslen); return true; } @@ -237,13 +237,13 @@ bool fstype(FF_PKT *ff_pkt, char *fs, int fslen) case 0x7275: fstype = "romfs"; break; /* QNX4_SUPER_MAGIC */ case 0x012ff7b6: fstype = "sysv2"; break; case 0x012ff7b5: fstype = "sysv4"; break; - case 0x01021994: fstype = "tempfs"; break; + case 0x01021994: fstype = "tmpfs"; break; case 0x15013346: fstype = "udf"; break; case 0x00011954: fstype = "ufs"; break; case 0xa501FCF5: fstype = "vxfs"; break; case 0x012FF7B4: fstype = "xenix"; break; case 0x012FD16D: fstype = "xiafs"; break; - + case 0x9123683e: fstype = "btrfs"; break; #if 0 /* These need confirmation */ case 0x6B414653: fstype = "afs"; break; /* AFS_FS_MAGIC */ -- 2.39.5