+Changes to 1.37.14:
+26Apr05
+- Apply Tru64 patch supplied by Pascal Pederiva <freebsd@paped.com>
+- Apply Unicode fixes for Win32 from "Thorsten Engel"
+ <thorsten.engel@matrix-computer.com>
+- More work on Python read feature in FD.
+22Apr05
+- Fix (hopefully) the ftello() overflow reported by Peter.
+- Landon Fuller committed his TLS patch.
+- Fixed two minor warnings in console.c with TLS turned off.
+- Updated the Makefile.in for wx-windows and tray-monitor
+ to handle TLS. I can only build the tray-monitor.
+- Fix bscan to open tape in read-only mode (actually fix
+ it so that it doesn't use the standard open routine).
+- Correct what appears to be an error in setting the
+ return value in dvd.c
+21Apr05
+- Get FD Python running -- design Python backup interface.
+- Fix seg fault in SD when referencing Alert Command.
+- More documentation.
+- Fix one more thing in Win32 build.
+20Apr05
+- Doc updates
+- Fix Win32 build
+- Put in production here
+
+Changes to 1.37.13:
+19Apr05
+- Fix SQLite and PostgreSQL table creation script syntax
+ problems.
+- Fix new Python code to work for Director.
+- Move lib/python.c to lib/pythonlib.c so that debug output
+ is easier to read (can distinguish lib from dird, ...).
+- Cleanup Python build so that Python is not dragged
+ into programs that don't use it.
+
Changes to 1.37.12:
02Apr05
- Reset NumVols in Pool record from database on every update
Kern's ToDo List
- 22 April 2005
+ 26 April 2005
Major development:
Project Developer
======= =========
IPv6_2 Meno Abels
+TLS Landon Fuller
+Unicode in Win32 Thorsten Engle
+VSS Thorsten Engle (under consideration)
Version 1.37 Kern (see below)
========================================================
1.37 Major Projects:
#3 Migration (Move, Copy, Archive Jobs)
+ (probably not this version)
#7 Single Job Writing to Multiple Storage Devices
- (probably not)
+ (probably not this version)
## Integrate web-bacula into a new Bacula project with
bimagemgr.
- Make "update slots" when pointing to Autochanger, remove
all Volumes from other drives. "update slots all-drives"?
-Ideas:
-- Use non-blocking network I/O but if no data is available, use
- select().
-- Use gather write() for network I/O.
-- Autorestart on crash.
For 1.37:
-- Indicate when a Job is purged/pruned.
+- Python:
+ - Make a callback when Rerun failed levels is called.
+ - Give Python program access to Scheduled jobs.
+ - Python script to save with Python, not save, save with Bacula.
+ - Python script to do backup.
+ - What events?
+ - Change the Priority, Client, Storage, JobStatus (error)
+ at the start of a job.
+ - Make sure that Python has access to Client address/port so that
+ it can check if Clients are alive.
+
- If drive is opened read/write, close it and re-open
read-only if doing a restore, and vice-versa.
-- Fix FD JobType to be set before RunBeforeJob in FD.
- SD crashes after a tape restore then doing a backup.
-- Look at dird_conf.c:1000: warning: `int size'
- might be used uninitialized in this function
-- Make a callback when Rerun failed levels is called.
-- Give Python program access to Scheduled jobs.
- Implement some way to turn off automatic pruning in Jobs.
- Implement a way an Admin Job can prune, possibly multiple
clients -- Python script?
- Implement "NewVolumeEachJob = yes|no" in Dir.
-- FD Python
- - Python script to save with Python, not save, save with Bacula.
- - Python script to do backup.
- Create a new GUI chapter explaining all the GUI programs.
- Look at Preben's acl.c error handling code.
-- Look at adding full Volume and Pool information to a Volume
- label so that bscan can get *all* the info.
- Implement Maximum Job Spool Size
- Remove all old Device resource code in Dir and code to pass it
back in SD -- better, rework it to pass back device statistics.
- Check locking of resources -- be sure to lock devices where previously
resources were locked.
- Add global lock on all devices when creating a device structure.
-- Make sure that Python has access to Client address/port so that
- it can check if Clients are alive.
-- Cleanup and complete Python scripting.
- - What events?
- - Change the Priority, Client, Storage, JobStatus (error)
- at the start of a job.
+- Look at adding full Volume and Pool information to a Volume
+ label so that bscan can get *all* the info.
+- Fix FD JobType to be set before RunBeforeJob in FD.
+
+
+Ideas:
+- Use non-blocking network I/O but if no data is available, use
+ select().
+- Use gather write() for network I/O.
+- Autorestart on crash.
Maybe in 1.37:
- If the user puts "Purge Oldest Volume = yes" or "Recycle Oldest Volume = yes"
- Solicit Events
- Add disk seeking on restore; turn off seek on tapes.
stored/match_bsr.c
+- Look at dird_conf.c:1000: warning: `int size'
+ might be used uninitialized in this function
+- Indicate when a Job is purged/pruned during restore.
+
#define ftello ftell
#endif
+#if defined (__digital__) && defined (__unix__)
+/* Tru64 - it does have fseeko and ftello , but since ftell/fseek are also 64 bit */
+/* take this 'shortcut' */
+#define fseeko fseek
+#define ftello ftell
+#endif
+
+
#ifdef __alpha__
#define OSF 1
#endif
bconsole: $(CONSOBJS) ../lib/libbac.a
$(CXX) $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \
- $(DLIB) $(CONS_LIBS) $(OPENSSL_LIBS) -lbac -lm $(LIBS)
+ $(DLIB) $(CONS_LIBS) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
static-bconsole: $(CONSOBJS) ../lib/libbac.a
$(CXX) -static $(LDFLAGS) $(CONS_LDFLAGS) -L../lib -L../cats -o $@ $(CONSOBJS) \
- $(DLIB) $(CONS_LIBS) $(OPENSSL_LIBS) -lbac -lm $(LIBS)
+ $(DLIB) $(CONS_LIBS) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
strip $@
extern "C" char *tgoto (const char *, int, int);
#elif HAVE_HPUX_OS
#include <term.h>
+#elif defined (__digital__) && defined (__unix__)
+extern "C" int tgetent(void *, const char *);
+extern "C" int tgetnum(const char *);
+extern "C" char *tgetstr (const char*, char**);
+extern "C" char *tgoto (const char *, int, int);
+
#else
#include <termcap.h>
#endif
bacula-dir: $(SVROBJS) ../lib/libbac.a ../cats/libsql.a ../findlib/libfind.a
$(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../cats -L../findlib -o $@ $(SVROBJS) \
- -lsql -lfind -lbac -lm $(PYTHON_LIBS) $(OPENSSL_LIBS) $(DLIB) $(DB_LIBS) $(LIBS)
+ -lsql -lfind -lbac -lm $(PYTHON_LIBS) $(DLIB) $(DB_LIBS) $(LIBS) $(OPENSSL_LIBS)
static-bacula-dir: $(SVROBJS) ../lib/libbac.a ../cats/libsql.a ../findlib/libfind.a
$(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -L../cats -L../findlib -o $@ $(SVROBJS) \
- -lsql -lbac -lfind -lm $(PYTHON_LIBS) $(OPENSSL_LIBS) $(DLIB) $(DB_LIBS) $(LIBS)
+ -lsql -lbac -lfind -lm $(PYTHON_LIBS) $(DLIB) $(DB_LIBS) $(LIBS) $(OPENSSL_LIBS)
strip $@
/* Find MediaType used by this Job */
const char *uar_mediatype =
- "SELECT MediaType FROM JobMedia,Media WHERE JobMedia.JobId=%s"
+ "SELECT MediaType FROM JobMedia,Media WHERE JobMedia.JobId=%s "
"AND JobMedia.MediaId=Media.MediaId";
/*
const char *uar_jobid_fileindex_from_dir =
"SELECT Job.JobId,File.FileIndex FROM Job,File,Path,Filename,Client "
"WHERE Job.JobId IN (%s) "
- "WHERE Job.JobId=File.JobId "
+ "AND Job.JobId=File.JobId "
"AND Path.Path='%s' "
"AND Client.Name='%s' "
"AND Job.ClientId=Client.ClientId "
"Select backup for a client before a specified time",
"Enter a list of files to restore",
"Enter a list of files to restore before a specified time",
- "Enter a list of directories to restore for a given JobId",
+ "Find the JobIds of the most recent backup for a client",
+ "Find the JobIds for a backup for a client before a specified time",
+ "Enter a list of directories to restore for given JobIds",
"Cancel",
NULL };
}
return 2;
- case 8: /* Enter directories */
- if (get_cmd(ua, _("Enter JobId(s), comma separated, to restore: "))) {
- if (*rx->JobIds != 0) {
+ case 8: /* Find JobIds for current backup */
+ bstrutime(date, sizeof(date), time(NULL));
+ if (!select_backups_before_date(ua, rx, date)) {
+ return 0;
+ }
+ done = false;
+ break;
+
+ case 9: /* Find JobIds for give date */
+ if (!get_date(ua, date, sizeof(date))) {
+ return 0;
+ }
+ if (!select_backups_before_date(ua, rx, date)) {
+ return 0;
+ }
+ done = false;
+ break;
+
+ case 10: /* Enter directories */
+ if (*rx->JobIds != 0) {
+ bsendmsg(ua, _("You have already seleted the following JobIds: %s\n"),
+ rx->JobIds);
+ } else if (get_cmd(ua, _("Enter JobId(s), comma separated, to restore: "))) {
+ if (*rx->JobIds != 0 && *ua->cmd) {
pm_strcat(rx->JobIds, ",");
}
- pm_strcpy(rx->JobIds, ua->cmd);
+ pm_strcat(rx->JobIds, ua->cmd);
}
- if (*rx->JobIds != 0) {
- return 0;
+ if (*rx->JobIds == 0 || *rx->JobIds == '.') {
+ return 0; /* nothing entered, return */
}
bstrutime(date, sizeof(date), time(NULL));
if (!get_client_name(ua, rx)) {
"containg a list of directories and terminate\n"
"them with a blank line.\n"));
for ( ;; ) {
- if (!get_cmd(ua, _("Enter full filename: "))) {
+ if (!get_cmd(ua, _("Enter directory name: "))) {
return 0;
}
len = strlen(ua->cmd);
if (len == 0) {
break;
}
+ if (ua->cmd[len-1] != '/') {
+ strcat(ua->cmd, "/");
+ }
insert_one_file_or_dir(ua, rx, date, true);
}
/* Check MediaType and select storage that corresponds */
}
return 2;
- case 9: /* Cancel or quit */
+ case 11: /* Cancel or quit */
return 0;
}
}
static bool insert_dir_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *dir,
char *date)
{
+ char ed1[50];
+
strip_trailing_junk(dir);
if (*rx->JobIds == 0) {
bsendmsg(ua, _("No JobId specified cannot continue.\n"));
/*
* Find the MediaTypes for this JobId and add to the name_list
*/
- Mmsg(rx->query, uar_mediatype, rx->JobId);
+ Mmsg(rx->query, uar_mediatype, edit_int64(rx->JobId, ed1));
if (!db_sql_query(ua->db, rx->query, unique_name_list_handler, (void *)&rx->name_list)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
return false;
}
if (tree.FileCount == 0) {
bsendmsg(ua, "\nThere were no files inserted into the tree, so file selection\n"
- "is not possible.\n");
+ "is not possible.\nMost likely your retention policy pruned the files\n");
if (!get_yesno(ua, _("Do you want to restore all the files? (yes|no): "))) {
OK = false;
} else {
bacula-fd: $(SVROBJS) ../findlib/libfind.a ../lib/libbac.a @WIN32@
$(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(SVROBJS) \
- $(WIN32LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(OPENSSL_LIBS) $(LIBS) $(DLIB)
+ $(WIN32LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(LIBS) $(DLIB) $(OPENSSL_LIBS)
static-bacula-fd: $(SVROBJS) ../findlib/libfind.a ../lib/libbac.a @WIN32@
$(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -L../findlib -o $@ $(SVROBJS) \
- $(WIN32LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(OPENSSL_LIBS) $(LIBS) $(DLIB)
+ $(WIN32LIBS) $(FDLIBS) -lfind -lbac -lm $(PYTHON_LIBS) $(LIBS) $(DLIB) $(OPENSSL_LIBS)
strip $@
/*
- Copyright (C) 2000-2004 Kern Sibbald and John Walker
+ Copyright (C) 2000-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
if (hLib) {
p_GetFileAttributesExA = (t_GetFileAttributesExA)
GetProcAddress(hLib, "GetFileAttributesExA");
- p_GetFileAttributesExW = (t_GetFileAttributesExW)
+ p_GetFileAttributesExW = (t_GetFileAttributesExW)
GetProcAddress(hLib, "GetFileAttributesExW");
p_SetProcessShutdownParameters = (t_SetProcessShutdownParameters)
GetProcAddress(hLib, "SetProcessShutdownParameters");
*
*/
/*
- Copyright (C) 2002-2004 Kern Sibbald and John Walker
+ Copyright (C) 2002-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
#endif
/*=============================================================*/
-/* */
-/* *** A l l S y s t e m s *** */
-/* */
+/* */
+/* *** A l l S y s t e m s *** */
+/* */
/*=============================================================*/
/*
#ifdef HAVE_LIBZ
if (ff_pkt->flags & FO_GZIP) {
if (stream == STREAM_WIN32_DATA) {
- stream = STREAM_WIN32_GZIP_DATA;
+ stream = STREAM_WIN32_GZIP_DATA;
} else if (stream == STREAM_FILE_DATA) {
- stream = STREAM_GZIP_DATA;
+ stream = STREAM_GZIP_DATA;
} else {
- stream = STREAM_SPARSE_GZIP_DATA;
+ stream = STREAM_SPARSE_GZIP_DATA;
}
}
#endif
struct stat *statp = &ff_pkt->statp;
/*
* Encode a stat packet. I should have done this more intelligently
- * with a length so that it could be easily expanded.
+ * with a length so that it could be easily expanded.
*/
p += to_base64((int64_t)statp->st_dev, p);
*p++ = ' '; /* separate fields with a space */
/* Do casting according to unknown type to keep compiler happy */
#if !HAVE_GCC & HAVE_SUN_OS
-#define plug(st, val) st = val /* brain damaged compiler */
+#define plug(st, val) st = val /* brain damaged compiler */
#else
template <class T> void plug(T &st, uint64_t val)
{ st = static_cast<T>(val); }
char *p = buf;
int64_t val;
- skip_nonspaces(&p); /* st_dev */
- p++; /* skip space */
- skip_nonspaces(&p); /* st_ino */
+ skip_nonspaces(&p); /* st_dev */
+ p++; /* skip space */
+ skip_nonspaces(&p); /* st_ino */
p++;
p += from_base64(&val, p);
- plug(statp->st_mode, val); /* st_mode */
+ plug(statp->st_mode, val); /* st_mode */
p++;
- skip_nonspaces(&p); /* st_nlink */
+ skip_nonspaces(&p); /* st_nlink */
p++;
- skip_nonspaces(&p); /* st_uid */
+ skip_nonspaces(&p); /* st_uid */
p++;
- skip_nonspaces(&p); /* st_gid */
+ skip_nonspaces(&p); /* st_gid */
p++;
- skip_nonspaces(&p); /* st_rdev */
+ skip_nonspaces(&p); /* st_rdev */
p++;
- skip_nonspaces(&p); /* st_size */
+ skip_nonspaces(&p); /* st_size */
p++;
- skip_nonspaces(&p); /* st_blksize */
+ skip_nonspaces(&p); /* st_blksize */
p++;
- skip_nonspaces(&p); /* st_blocks */
+ skip_nonspaces(&p); /* st_blocks */
p++;
- skip_nonspaces(&p); /* st_atime */
+ skip_nonspaces(&p); /* st_atime */
p++;
- skip_nonspaces(&p); /* st_mtime */
+ skip_nonspaces(&p); /* st_mtime */
p++;
- skip_nonspaces(&p); /* st_ctime */
+ skip_nonspaces(&p); /* st_ctime */
/* Optional FileIndex of hard linked file data */
if (*p == ' ' || (*p != 0 && *(p+1) == ' ')) {
* ofile is the output filename (may be in a different directory)
*
* Returns: true on success
- * false on failure
+ * false on failure
*/
bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
{
if (attr->stream == STREAM_UNIX_ATTRIBUTES_EX &&
set_win32_attributes(jcr, attr, ofd)) {
if (is_bopen(ofd)) {
- bclose(ofd);
+ bclose(ofd);
}
pm_strcpy(attr->ofname, "*none*");
return true;
if (attr->data_stream == STREAM_WIN32_DATA ||
attr->data_stream == STREAM_WIN32_GZIP_DATA) {
if (is_bopen(ofd)) {
- bclose(ofd);
+ bclose(ofd);
}
pm_strcpy(attr->ofname, "*none*");
return true;
if (is_bopen(ofd)) {
char ec1[50], ec2[50];
fsize = blseek(ofd, 0, SEEK_CUR);
- bclose(ofd); /* first close file */
+ bclose(ofd); /* first close file */
if (fsize > 0 && fsize != attr->statp.st_size) {
Jmsg3(jcr, M_ERROR, 0, _("File size of restored file %s not correct. Original %s, restored %s.\n"),
- attr->ofname, edit_uint64(attr->statp.st_size, ec1),
- edit_uint64(fsize, ec2));
+ attr->ofname, edit_uint64(attr->statp.st_size, ec1),
+ edit_uint64(fsize, ec2));
}
}
/* ***FIXME**** optimize -- don't do if already correct */
/*
* For link, change owner of link using lchown, but don't
- * try to do a chmod as that will update the file behind it.
+ * try to do a chmod as that will update the file behind it.
*/
if (attr->type == FT_LNK) {
/* Change owner of link, not of real file */
if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
} else {
if (chown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
if (chmod(attr->ofname, attr->statp.st_mode) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
/*
* Reset file times.
*/
if (utime(attr->ofname, &ut) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
#ifdef HAVE_CHFLAGS
/*
* fail.
*/
if (chflags(attr->ofname, attr->statp.st_flags) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file flags %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
#endif
}
/*=============================================================*/
-/* */
-/* * * * U n i x * * * * */
-/* */
+/* */
+/* * * * U n i x * * * * */
+/* */
/*=============================================================*/
#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
* here. They must be "self-contained" (i.e. you keep track
* of your own length), and they must be in ASCII string
* format. Using this feature is not recommended.
- * The code below shows how to return nothing. See the Win32
+ * The code below shows how to return nothing. See the Win32
* code below for returning something in the attributes.
*/
int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
}
*p = 0;
#else
- *attribsEx = 0; /* no extended attributes */
+ *attribsEx = 0; /* no extended attributes */
#endif
return STREAM_UNIX_ATTRIBUTES;
}
/*=============================================================*/
-/* */
-/* * * * W i n 3 2 * * * * */
-/* */
+/* */
+/* * * * W i n 3 2 * * * * */
+/* */
/*=============================================================*/
#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
WIN32_FILE_ATTRIBUTE_DATA atts;
ULARGE_INTEGER li;
- attribsEx[0] = 0; /* no extended attributes */
+ attribsEx[0] = 0; /* no extended attributes */
#if USE_WIN32_UNICODE
if (!p_GetFileAttributesExW)
UTF8_2_wchar(szBuf, ff_pkt->sys_fname, MAX_PATH_UNICODE);
if (!p_GetFileAttributesExW(szBuf, GetFileExInfoStandard,
- (LPVOID)&atts)) {
+ (LPVOID)&atts)) {
win_error(jcr, "GetFileAttributesExW:", ff_pkt->sys_fname);
return STREAM_UNIX_ATTRIBUTES;
}
unix_name_to_win32(&ff_pkt->sys_fname, ff_pkt->fname);
if (!p_GetFileAttributesExA(ff_pkt->sys_fname, GetFileExInfoStandard,
- (LPVOID)&atts)) {
+ (LPVOID)&atts)) {
win_error(jcr, "GetFileAttributesExA:", ff_pkt->sys_fname);
return STREAM_UNIX_ATTRIBUTES;
}
FILE_ATTRIBUTE_OFFLINE| \
FILE_ATTRIBUTE_READONLY| \
FILE_ATTRIBUTE_SYSTEM| \
- FILE_ATTRIBUTE_TEMPORARY)
+ FILE_ATTRIBUTE_TEMPORARY)
/*
* ofile is the output filename (may be in a different directory)
*
* Returns: true on success
- * false on failure
+ * false on failure
*/
static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
{
if (!p_GetFileAttributesExW)
return false;
#else
- if (!p_GetFileAttributesExA)
+ if (!p_GetFileAttributesExA)
return false;
#endif
- if (!p || !*p) { /* we should have attributes */
+ if (!p || !*p) { /* we should have attributes */
Dmsg2(100, "Attributes missing. of=%s ofd=%d\n", attr->ofname, ofd->fid);
if (is_bopen(ofd)) {
- bclose(ofd);
+ bclose(ofd);
}
return false;
} else {
p += from_base64(&val, p);
plug(atts.dwFileAttributes, val);
- p++; /* skip space */
+ p++; /* skip space */
p += from_base64(&val, p);
li.QuadPart = val;
atts.ftCreationTime.dwLowDateTime = li.LowPart;
atts.ftCreationTime.dwHighDateTime = li.HighPart;
- p++; /* skip space */
+ p++; /* skip space */
p += from_base64(&val, p);
li.QuadPart = val;
atts.ftLastAccessTime.dwLowDateTime = li.LowPart;
atts.ftLastAccessTime.dwHighDateTime = li.HighPart;
- p++; /* skip space */
+ p++; /* skip space */
p += from_base64(&val, p);
li.QuadPart = val;
atts.ftLastWriteTime.dwLowDateTime = li.LowPart;
if (!is_bopen(ofd)) {
Dmsg1(100, "File not open: %s\n", attr->ofname);
- bopen(ofd, attr->ofname, O_WRONLY|O_BINARY, 0); /* attempt to open the file */
+ bopen(ofd, attr->ofname, O_WRONLY|O_BINARY, 0); /* attempt to open the file */
}
if (is_bopen(ofd)) {
Dmsg1(100, "SetFileTime %s\n", attr->ofname);
if (!SetFileTime(bget_handle(ofd),
- &atts.ftCreationTime,
- &atts.ftLastAccessTime,
- &atts.ftLastWriteTime)) {
+ &atts.ftCreationTime,
+ &atts.ftLastAccessTime,
+ &atts.ftLastWriteTime)) {
win_error(jcr, "SetFileTime:", win32_ofile);
}
bclose(ofd);
DWORD lerror = GetLastError();
LPTSTR msg;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- lerror,
- 0,
- (LPTSTR)&msg,
- 0,
- NULL);
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ lerror,
+ 0,
+ (LPTSTR)&msg,
+ 0,
+ NULL);
Dmsg3(100, "Error in %s on file %s: ERR=%s\n", prefix, win32_ofile, msg);
strip_trailing_junk(msg);
Jmsg(jcr, M_ERROR, 0, _("Error in %s file %s: ERR=%s\n"), prefix, win32_ofile, msg);
{
LPTSTR msg;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- lerror,
- 0,
- (LPTSTR)&msg,
- 0,
- NULL);
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ lerror,
+ 0,
+ (LPTSTR)&msg,
+ 0,
+ NULL);
strip_trailing_junk(msg);
if (jcr) {
Jmsg2(jcr, M_ERROR, 0, _("Error in %s: ERR=%s\n"), prefix, msg);
cygwin_conv_to_win32_path(name, *win32_name);
}
-#endif /* HAVE_CYGWIN */
+#endif /* HAVE_CYGWIN */
return false;
}
+#elif defined (__digital__) && defined (__unix__) /* Tru64 */
+/* Tru64 */
+#include <sys/stat.h>
+#include <sys/mount.h>
+
+bool fstype(const char *fname, char *fs, int fslen)
+{
+ struct statfs st;
+ if (statfs((char *)fname, &st) == 0) {
+ switch (st.f_type) {
+ /* Known good values */
+ case 0xa: bstrncpy(fs, "advfs", fslen); return true; /* Tru64 AdvFS */
+ case 0xe: bstrncpy(fs, "nfs", fslen); return true; /* Tru64 NFS */
+ default:
+ Dmsg2(10, "Unknown file system type \"0x%x\" for \"%s\".\n", st.f_type,
+ fname);
+ return false;
+ }
+ }
+ Dmsg1(50, "statfs() failed for \"%s\"\n", fname);
+ return false;
+}
+/* Tru64 */
+
#else /* No recognised OS */
bool fstype(const char *fname, char *fs, int fslen)
{
Dmsg0(10, "!!! fstype() not implemented for this OS. !!!\n");
-
#ifdef TEST_PROGRAM
Dmsg1(10, "Please define one of the following when compiling:\n\n%s\n",
SUPPORTEDOSES);
bacula-sd: $(SVROBJS) ../lib/libbac.a
$(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -o $@ $(SVROBJS) $(FDLIBS) \
- -lbac -lm $(PYTHON_LIBS) $(OPENSSL_LIBS) $(DLIB) $(LIBS)
+ -lbac -lm $(PYTHON_LIBS) $(DLIB) $(LIBS) $(OPENSSL_LIBS)
static-bacula-sd: $(SVROBJS) ../lib/libbac.a
$(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -o $@ $(SVROBJS) $(FDLIBS) \
- -lbac -lm $(PYTHON_LIBS) $(OPENSSL_LIBS) $(DLIB) $(LIBS)
+ -lbac -lm $(PYTHON_LIBS) $(DLIB) $(LIBS) $(OPENSSL_LIBS)
strip $@
btape.o: btape.c
btape: $(TAPEOBJS) ../lib/libbac.a ../cats/libsql.a
$(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../cats -o $@ $(TAPEOBJS) \
- -lsql $(OPENSSL_LIBS) $(DLIB) -lbac -lm $(LIBS)
+ -lsql $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
bls.o: bls.c
$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) \
-I$(basedir) $(OPENSSL_INC) $(DINCLUDE) $(CFLAGS) $<
bls: ../findlib/libfind.a $(BLSOBJS) ../lib/libbac.a
- $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(BLSOBJS) $(OPENSSL_LIBS) $(DLIB) -lfind \
- -lbac -lm $(OPENSSL_LIBS) $(LIBS)
+ $(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(BLSOBJS) $(DLIB) -lfind \
+ -lbac -lm $(LIBS) $(OPENSSL_LIBS)
bextract.o: bextract.c
$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) \
bextract: ../findlib/libfind.a $(BEXTOBJS) ../lib/libbac.a
$(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(BEXTOBJS) $(DLIB) $(FDLIBS) \
- -lfind -lbac -lm $(PYTHON_LIBS) $(OPENSSL_LIBS) $(LIBS)
+ -lfind -lbac -lm $(PYTHON_LIBS) $(LIBS) $(OPENSSL_LIBS)
bscan.o: bscan.c
$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) \
bscan: ../findlib/libfind.a $(SCNOBJS) ../cats/libsql.a
$(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../cats -L../findlib -o $@ $(SCNOBJS) \
- -lsql $(OPENSSL_LIBS) $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS)
+ -lsql $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS) $(OPENSSL_LIBS)
bcopy.o: bcopy.c
$(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) \
bcopy: $(COPYOBJS) ../findlib/libfind.a ../lib/libbac.a
$(CXX) $(TTOOL_LDFLAGS) $(LDFLAGS) -L../lib -L../findlib -o $@ $(COPYOBJS) \
- $(OPENSSL_LIBS) $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS)
+ $(DB_LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS) $(OPENSSL_LIBS)
Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
Dmsg0(200, "Device previously written, moving to end of data\n");
Jmsg(jcr, M_INFO, 0, _("Volume \"%s\" previously written, moving to end of data.\n"),
dcr->VolumeName);
+#if defined (__digital__) && defined (__unix__)
+ if (!fsf_dev(dev,dev->VolCatInfo.VolCatFiles)) {
+#else
if (!eod_dev(dev)) {
+#endif
Jmsg(jcr, M_ERROR, 0, _("Unable to position to end of data on device %s: ERR=%s\n"),
dev->print_name(), strerror_dev(dev));
mark_volume_in_error(dcr);
@echo " "
bsmtp: bsmtp.o ../lib/libbac.a
- $(CXX) $(LDFLAGS) -L../lib -o $@ bsmtp.o -lbac -lm $(OPENSSL_LIBS) $(DLIB) $(LIBS)
+ $(CXX) $(LDFLAGS) -L../lib -o $@ bsmtp.o -lbac -lm $(DLIB) $(LIBS) $(OPENSSL_LIBS)
dbcheck: dbcheck.o ../lib/libbac.a ../cats/libsql.a $(DIRCONFOBJS)
- $(CXX) $(LDFLAGS) -L../lib -L../cats -o $@ dbcheck.o $(DIRCONFOBJS) -lsql -lbac -lm $(OPENSSL_LIBS) $(DB_LIBS) $(LIBS)
+ $(CXX) $(LDFLAGS) -L../lib -L../cats -o $@ dbcheck.o $(DIRCONFOBJS) -lsql -lbac -lm $(DB_LIBS) $(LIBS) $(OPENSSL_LIBS)
fstype: fstype.o ../lib/libbac.a ../findlib/libfind.a
- $(CXX) $(LDFLAGS) -L../lib -L../findlib -o $@ fstype.o -lfind -lbac -lm $(OPENSSL_LIBS) $(DLIB) $(LIBS)
+ $(CXX) $(LDFLAGS) -L../lib -L../findlib -o $@ fstype.o -lfind -lbac -lm $(DLIB) $(LIBS) $(OPENSSL_LIBS)
testfind: ../findlib/libfind.a ../lib/libbac.a $(FINDOBJS)
$(CXX) -g $(LDFLAGS) -L. -L../lib -L../findlib -o $@ $(FINDOBJS) \
- $(OPENSSL_LIBS) $(DLIB) -lfind -lbac -lm $(LIBS)
+ $(DLIB) -lfind -lbac -lm $(LIBS) $(OPENSSL_LIBS)
testls: ../findlib/libfind.a ../lib/libbac.a testls.o
$(CXX) -g $(LDFLAGS) -L. -L../lib -L../findlib -o $@ testls.o \
- $(OPENSSL_LIBS) $(DLIB) -lfind -lbac -lm $(LIBS)
+ $(DLIB) -lfind -lbac -lm $(LIBS) $(OPENSSL_LIBS)
Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
cd $(topdir) \
bacula-tray-monitor: $(MONITOROBJS) ../lib/libbac.a
$(CXX) $(LDFLAGS) $(MONITOR_LDFLAGS) -L../lib -L../cats -o $@ \
- $(MONITOROBJS) $(DLIB) $(OPENSSL_LIBS) -lbac -lm $(LIBS)
+ $(MONITOROBJS) $(DLIB) -lbac -lm $(LIBS) $(OPENSSL_LIBS)
Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
/* */
#undef VERSION
#define VERSION "1.37.14"
-#define BDATE "22 April 2005"
-#define LSMDATE "22Apr05"
+#define BDATE "26 April 2005"
+#define LSMDATE "26Apr05"
/* Debug flags */
#undef DEBUG
// Copyright transferred from Raider Solutions, Inc to
// Kern Sibbald and John Walker by express permission.
//
-// Copyright (C) 2004 Kern Sibbald and John Walker
+// Copyright (C) 2004-2005 Kern Sibbald
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
int
wchar_2_UTF8(char *pszUTF, const WCHAR *pszUCS, int cchChar)
{
- /* the return value is the number of bytes written to the buffer.
- The number includes the byte for the null terminator. */
+ /* the return value is the number of bytes written to the buffer.
+ The number includes the byte for the null terminator. */
- return WideCharToMultiByte (CP_UTF8,0,pszUCS,-1,pszUTF,cchChar,NULL,NULL);
+ return WideCharToMultiByte (CP_UTF8,0,pszUCS,-1,pszUTF,cchChar,NULL,NULL);
}
int
UTF8_2_wchar(WCHAR *pszUCS, const char *pszUTF, int cchWideChar)
{
- /* the return value is the number of wide characters written to the buffer. */
- /* convert null terminated string from utf-8 to ucs2*/
- return MultiByteToWideChar(CP_UTF8, 0, pszUTF, -1, pszUCS,cchWideChar);
+ /* the return value is the number of wide characters written to the buffer. */
+ /* convert null terminated string from utf-8 to ucs2*/
+ return MultiByteToWideChar(CP_UTF8, 0, pszUTF, -1, pszUCS,cchWideChar);
}
#endif
statDir(const char *file, struct stat *sb)
{
#if USE_WIN32_UNICODE
- WIN32_FIND_DATAW info; // window's file info
+ WIN32_FIND_DATAW info; // window's file info
#else
WIN32_FIND_DATA info; // window's file info
#endif
}
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(szBuf, file, MAX_PATH_UNICODE);
-
- HANDLE h = FindFirstFileW(szBuf, &info);
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(szBuf, file, MAX_PATH_UNICODE);
+
+ HANDLE h = FindFirstFileW(szBuf, &info);
#else
HANDLE h = FindFirstFile(file, &info);
#endif
cygwin_conv_to_win32_path(file, tmpbuf);
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(szBuf, tmpbuf, MAX_PATH_UNICODE);
-
- DWORD attr = GetFileAttributesW(szBuf);
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(szBuf, tmpbuf, MAX_PATH_UNICODE);
+
+ DWORD attr = GetFileAttributesW(szBuf);
#else
DWORD attr = GetFileAttributes(tmpbuf);
#endif
return stat2(file, sb);
#else
#if USE_WIN32_UNICODE
- WCHAR buf[MAX_PATH_UNICODE];
- UTF8_2_wchar(buf, file, MAX_PATH_UNICODE);
- if (!GetFileAttributesExW(buf, GetFileExInfoStandard, &data))
+ WCHAR buf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(buf, file, MAX_PATH_UNICODE);
+ if (!GetFileAttributesExW(buf, GetFileExInfoStandard, &data))
return stat2(file, sb);
#else
if (!GetFileAttributesEx(file, GetFileExInfoStandard, &data))
strncat(tspec, "\\*", max_len);
rval->spec = tspec;
- // convert to WCHAR
+ // convert to WCHAR
#if USE_WIN32_UNICODE
- WCHAR wcBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(wcBuf,rval->spec, MAX_PATH_UNICODE);
- rval->dirh = FindFirstFileW(wcBuf, &rval->data);
+ WCHAR wcBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(wcBuf,rval->spec, MAX_PATH_UNICODE);
+ rval->dirh = FindFirstFileW(wcBuf, &rval->data);
#else
rval->dirh = FindFirstFile(rval->spec, &rval->data);
#endif
_dir *dp = (_dir *)dirp;
if (dp->valid) {
entry->d_off = dp->offset;
-
+
#if USE_WIN32_UNICODE
- char szBuf[MAX_PATH_UTF8];
- wchar_2_UTF8(szBuf,dp->data.cFileName);
- dp->offset += copyin(*entry, szBuf);
+ char szBuf[MAX_PATH_UTF8];
+ wchar_2_UTF8(szBuf,dp->data.cFileName);
+ dp->offset += copyin(*entry, szBuf);
#else
dp->offset += copyin(*entry, dp->data.cFileName);
#endif
-
+
*result = entry; /* return entry address */
d_msg(__FILE__, __LINE__,
99, "readdir_r(%p, { d_name=\"%s\", d_reclen=%d, d_off=%d\n",
}
#if USE_WIN32_UNICODE
- dp->valid = FindNextFileW(dp->dirh, &dp->data);
+ dp->valid = FindNextFileW(dp->dirh, &dp->data);
#else
- dp->valid = FindNextFileA(dp->dirh, &dp->data);
+ dp->valid = FindNextFileA(dp->dirh, &dp->data);
#endif
return 0;
win32_chdir(const char *dir)
{
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(szBuf, dir, MAX_PATH_UNICODE);
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(szBuf, dir, MAX_PATH_UNICODE);
- if (0 == SetCurrentDirectoryW(szBuf)) {
+ if (0 == SetCurrentDirectoryW(szBuf)) {
errno = b_errno_win32;
return -1;
}
#else
- if (0 == SetCurrentDirectoryA(dir)) {
+ if (0 == SetCurrentDirectoryA(dir)) {
errno = b_errno_win32;
return -1;
}
win32_mkdir(const char *dir)
{
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(szBuf, dir, MAX_PATH_UNICODE);
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(szBuf, dir, MAX_PATH_UNICODE);
- return _wmkdir(szBuf);
+ return _wmkdir(szBuf);
#else
- return _mkdir(dir);
+ return _mkdir(dir);
#endif
}
win32_getcwd(char *buf, int maxlen)
{
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- int n = GetCurrentDirectoryW(maxlen, szBuf);
- n = wchar_2_UTF8 (buf, szBuf, maxlen)-1;
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ int n = GetCurrentDirectoryW(maxlen, szBuf);
+ n = wchar_2_UTF8 (buf, szBuf, maxlen)-1;
#else
int n = GetCurrentDirectory(maxlen, buf);
#endif
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(szBuf, tmpbuf, MAX_PATH_UNICODE);
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(szBuf, tmpbuf, MAX_PATH_UNICODE);
- HANDLE h = CreateFileW(szBuf,
+ HANDLE h = CreateFileW(szBuf,
FILE_WRITE_ATTRIBUTES,
FILE_SHARE_WRITE,
NULL,
open(const char *file, int flags, int mode)
{
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(szBuf, file, MAX_PATH_UNICODE);
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(szBuf, file, MAX_PATH_UNICODE);
- return _wopen(szBuf, flags|_O_BINARY, mode);
+ return _wopen(szBuf, flags|_O_BINARY, mode);
#else
return _open(file, flags|_O_BINARY, mode);
#endif
#if USE_WIN32_UNICODE
- WCHAR szBuf[MAX_PATH_UNICODE];
- UTF8_2_wchar(szBuf, file, MAX_PATH_UNICODE);
+ WCHAR szBuf[MAX_PATH_UNICODE];
+ UTF8_2_wchar(szBuf, file, MAX_PATH_UNICODE);
- foo = CreateFileW(szBuf, access, shareMode, NULL, create, msflags, NULL);
+ foo = CreateFileW(szBuf, access, shareMode, NULL, create, msflags, NULL);
#else
foo = CreateFile(file, access, shareMode, NULL, create, msflags, NULL);
#endif
// Copyright transferred from Raider Solutions, Inc to
// Kern Sibbald and John Walker by express permission.
//
-// Copyright (C) 2004 Kern Sibbald and John Walker
+// Copyright (C) 2004-2005 Kern Sibbald
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
wx-console: $(CONSOBJS) @WIN32@ ../lib/libbac.a
$(CXX) $(CONSOBJS) $(WIN32RES) -o $@ $(LIBS) -L../lib $(CONS_LDFLAGS) \
- $(OPENSSL_LIBS) -lbac
+ -lbac $(OPENSSL_LIBS)
win32: wx-console_private.res