From ca6c427772e22770fa1624ca8a5e4b035b9714b7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 19 Feb 2007 17:59:15 +0000 Subject: [PATCH] kes Restore of sockets created false error messages because Bacula no longer restores sockets, but the code was still trying to set the attributes on a non-existent file. Reported by a user. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4212 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/findlib/attribs.c | 32 +++++++++++++++++++++----------- bacula/src/findlib/create_file.c | 22 +++++++++++----------- bacula/technotes-2.1 | 3 +++ 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 4e1122afe5..d747543e18 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -1,17 +1,7 @@ -/* - * Encode and decode standard Unix attributes and - * Extended attributes for Win32 and - * other non-Unix systems, or Unix systems with ACLs, ... - * - * Kern Sibbald, October MMII - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2006 Free Software Foundation Europe e.V. + Copyright (C) 2002-2007 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -35,6 +25,16 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Encode and decode standard Unix attributes and + * Extended attributes for Win32 and + * other non-Unix systems, or Unix systems with ACLs, ... + * + * Kern Sibbald, October MMII + * + * Version $Id$ + * + */ #include "bacula.h" #include "find.h" @@ -410,6 +410,14 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) } } + /* + * We do not restore sockets, so skip trying to restore their + * attributes. + */ + if (attr->type == FT_SPEC && S_ISSOCK(attr->statp.st_mode)) { + goto bail_out; + } + ut.actime = attr->statp.st_atime; ut.modtime = attr->statp.st_mtime; @@ -465,6 +473,8 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) } #endif } + +bail_out: pm_strcpy(attr->ofname, "*none*"); umask(old_mask); return ok; diff --git a/bacula/src/findlib/create_file.c b/bacula/src/findlib/create_file.c index 3d08fdcc84..0cbf644fda 100644 --- a/bacula/src/findlib/create_file.c +++ b/bacula/src/findlib/create_file.c @@ -1,15 +1,7 @@ -/* - * Create a file, and reset the modes - * - * Kern Sibbald, November MM - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -33,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Create a file, and reset the modes + * + * Kern Sibbald, November MM + * + * Version $Id$ + * + */ #include "bacula.h" #include "find.h" @@ -235,7 +235,7 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace) attr->ofname, be.strerror()); return CF_ERROR; } - } else if(S_ISSOCK(attr->statp.st_mode)) { + } else if (S_ISSOCK(attr->statp.st_mode)) { Dmsg1(200, "Skipping restore of socket: %s\n", attr->ofname); } else { Dmsg1(200, "Restore node: %s\n", attr->ofname); @@ -297,7 +297,7 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace) * preventing this. So attempt to disable, retry link, * and reset flags. * Note that BSD securelevel may prevent disabling flag. - */ + */ if (stat(attr->olname, &s) == 0 && s.st_flags != 0) { if (chflags(attr->olname, 0) == 0) { diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index fbfb78eb72..a2fba763d7 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -2,6 +2,9 @@ General: 19Feb07 +kes Restore of sockets created false error messages because Bacula + no longer restores sockets, but the code was still trying to + set the attributes on a non-existent file. Reported by a user. ebl finish RecyclePool feature Media will takes Pool.RecyclePool when moving from Scratch to a Pool or when user will do -- 2.39.5