From: Kern Sibbald Date: Tue, 26 Apr 2005 15:04:27 +0000 (+0000) Subject: - Implement restore of a single directory. X-Git-Tag: Release-1.38.0~540 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=10c05f312f2836c0d04a7478d2c33a14aa82631b;p=bacula%2Fbacula - Implement restore of a single directory. - Apply Tru64 patch supplied by Pascal Pederiva freebsd@paped.com - Apply Unicode fixes for Win32 from Thorsten Engel thorsten.engel@matrix-computer.com git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1958 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/ChangeLog b/bacula/ChangeLog index 4bdbd37550..d6d28923a8 100644 --- a/bacula/ChangeLog +++ b/bacula/ChangeLog @@ -1,4 +1,40 @@ +Changes to 1.37.14: +26Apr05 +- Apply Tru64 patch supplied by Pascal Pederiva +- Apply Unicode fixes for Win32 from "Thorsten Engel" + +- 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 diff --git a/bacula/kernstodo b/bacula/kernstodo index 8f7975501b..0ed8b654ae 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -1,17 +1,21 @@ 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. @@ -27,33 +31,28 @@ Autochangers: - 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. @@ -62,12 +61,16 @@ For 1.37: - 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" @@ -1317,3 +1320,7 @@ Block Position: 0 - 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. + diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 5cda012fd1..d74b673f5e 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -490,6 +490,14 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) #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 diff --git a/bacula/src/console/Makefile.in b/bacula/src/console/Makefile.in index 37150fc522..95f2026de7 100644 --- a/bacula/src/console/Makefile.in +++ b/bacula/src/console/Makefile.in @@ -48,11 +48,11 @@ all: Makefile bconsole @STATIC_CONS@ 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 $@ diff --git a/bacula/src/console/conio.c b/bacula/src/console/conio.c index 94ffeaea1c..140a79ad31 100755 --- a/bacula/src/console/conio.c +++ b/bacula/src/console/conio.c @@ -61,6 +61,12 @@ extern "C" char *tgetstr (const char*, char**); extern "C" char *tgoto (const char *, int, int); #elif HAVE_HPUX_OS #include +#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 #endif diff --git a/bacula/src/dird/Makefile.in b/bacula/src/dird/Makefile.in index 9f5a43a4a1..504f4d4f05 100644 --- a/bacula/src/dird/Makefile.in +++ b/bacula/src/dird/Makefile.in @@ -76,11 +76,11 @@ all: Makefile bacula-dir @STATIC_DIR@ 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 $@ diff --git a/bacula/src/dird/sql_cmds.c b/bacula/src/dird/sql_cmds.c index 5970758fe6..afbe5bbbeb 100644 --- a/bacula/src/dird/sql_cmds.c +++ b/bacula/src/dird/sql_cmds.c @@ -326,7 +326,7 @@ const char *uar_sel_fileset = /* 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"; /* @@ -362,7 +362,7 @@ const char *uar_jobids_fileindex = 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 " diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 0c958af04d..59947a36d5 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -306,7 +306,9 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) "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 }; @@ -539,15 +541,36 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) } 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)) { @@ -557,13 +580,16 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *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 */ @@ -572,7 +598,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) } return 2; - case 9: /* Cancel or quit */ + case 11: /* Cancel or quit */ return 0; } } @@ -726,6 +752,8 @@ static bool insert_file_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *f 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")); @@ -747,7 +775,7 @@ static bool insert_dir_into_findex_list(UAContext *ua, RESTORE_CTX *rx, char *di /* * 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; @@ -867,7 +895,7 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) } 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 { diff --git a/bacula/src/filed/Makefile.in b/bacula/src/filed/Makefile.in index bd50d310bf..859b7e39ab 100755 --- a/bacula/src/filed/Makefile.in +++ b/bacula/src/filed/Makefile.in @@ -78,11 +78,11 @@ win32: $(WIN32OBJS) 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 $@ diff --git a/bacula/src/filed/win32/winmain.cpp b/bacula/src/filed/win32/winmain.cpp index 669487d631..5e21221733 100755 --- a/bacula/src/filed/win32/winmain.cpp +++ b/bacula/src/filed/win32/winmain.cpp @@ -1,5 +1,5 @@ /* - 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 @@ -306,7 +306,7 @@ int BaculaAppMain() 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"); diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 815ea4bedb..f96457de6a 100755 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -9,7 +9,7 @@ * */ /* - 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 @@ -48,9 +48,9 @@ HANDLE bget_handle(BFILE *bfd); #endif /*=============================================================*/ -/* */ -/* *** A l l S y s t e m s *** */ -/* */ +/* */ +/* *** A l l S y s t e m s *** */ +/* */ /*=============================================================*/ /* @@ -72,11 +72,11 @@ int select_data_stream(FF_PKT *ff_pkt) #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 @@ -101,7 +101,7 @@ void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream) 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 */ @@ -154,7 +154,7 @@ void encode_stat(char *buf, FF_PKT *ff_pkt, int data_stream) /* 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 void plug(T &st, uint64_t val) { st = static_cast(val); } @@ -252,32 +252,32 @@ int32_t decode_LinkFI(char *buf, struct stat *statp) 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) == ' ')) { @@ -295,7 +295,7 @@ int32_t decode_LinkFI(char *buf, struct stat *statp) * 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) { @@ -308,7 +308,7 @@ 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; @@ -316,7 +316,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) 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; @@ -334,11 +334,11 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) 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)); } } @@ -348,38 +348,38 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) /* ***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 /* @@ -390,10 +390,10 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) * 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 } @@ -404,9 +404,9 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) /*=============================================================*/ -/* */ -/* * * * U n i x * * * * */ -/* */ +/* */ +/* * * * U n i x * * * * */ +/* */ /*=============================================================*/ #if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32) @@ -417,7 +417,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) * 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) @@ -434,7 +434,7 @@ 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; } @@ -444,9 +444,9 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) /*=============================================================*/ -/* */ -/* * * * W i n 3 2 * * * * */ -/* */ +/* */ +/* * * * W i n 3 2 * * * * */ +/* */ /*=============================================================*/ #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) @@ -457,7 +457,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) 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) @@ -469,7 +469,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) 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; } @@ -480,7 +480,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) 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; } @@ -516,7 +516,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) FILE_ATTRIBUTE_OFFLINE| \ FILE_ATTRIBUTE_READONLY| \ FILE_ATTRIBUTE_SYSTEM| \ - FILE_ATTRIBUTE_TEMPORARY) + FILE_ATTRIBUTE_TEMPORARY) /* @@ -526,7 +526,7 @@ int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt) * 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) { @@ -540,15 +540,15 @@ 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 { @@ -557,17 +557,17 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) 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; @@ -589,15 +589,15 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) 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); @@ -627,13 +627,13 @@ void win_error(JCR *jcr, char *prefix, POOLMEM *win32_ofile) 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); @@ -644,13 +644,13 @@ void win_error(JCR *jcr, char *prefix, DWORD lerror) { 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); @@ -671,4 +671,4 @@ void unix_name_to_win32(POOLMEM **win32_name, char *name) cygwin_conv_to_win32_path(name, *win32_name); } -#endif /* HAVE_CYGWIN */ +#endif /* HAVE_CYGWIN */ diff --git a/bacula/src/findlib/fstype.c b/bacula/src/findlib/fstype.c index deb02b7b18..416e7bc382 100644 --- a/bacula/src/findlib/fstype.c +++ b/bacula/src/findlib/fstype.c @@ -223,12 +223,35 @@ bool fstype(const char *fname, char *fs, int fslen) return false; } +#elif defined (__digital__) && defined (__unix__) /* Tru64 */ +/* Tru64 */ +#include +#include + +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); diff --git a/bacula/src/stored/Makefile.in b/bacula/src/stored/Makefile.in index 672f171f90..3899ecffd9 100644 --- a/bacula/src/stored/Makefile.in +++ b/bacula/src/stored/Makefile.in @@ -98,11 +98,11 @@ all: Makefile bacula-sd @STATIC_SD@ bls bextract bscan btape bcopy 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 @@ -111,15 +111,15 @@ 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) \ @@ -127,7 +127,7 @@ bextract.o: bextract.c 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) \ @@ -135,7 +135,7 @@ bscan.o: bscan.c 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) \ @@ -143,7 +143,7 @@ bcopy.o: bcopy.c 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 diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index fb7723a614..086e7fbc33 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -341,7 +341,11 @@ read_volume: 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); diff --git a/bacula/src/tools/Makefile.in b/bacula/src/tools/Makefile.in index 863faa2c00..62bf472586 100644 --- a/bacula/src/tools/Makefile.in +++ b/bacula/src/tools/Makefile.in @@ -48,21 +48,21 @@ all: Makefile bsmtp dbcheck fstype testfind testls @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) \ diff --git a/bacula/src/tray-monitor/Makefile.in b/bacula/src/tray-monitor/Makefile.in index bb304093ee..55251e94ee 100644 --- a/bacula/src/tray-monitor/Makefile.in +++ b/bacula/src/tray-monitor/Makefile.in @@ -47,7 +47,7 @@ all: Makefile bacula-tray-monitor @STATIC_CONS@ 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 diff --git a/bacula/src/version.h b/bacula/src/version.h index 3cf760a3bf..f3881e505e 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #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 diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index b911c1f81f..01e89040f7 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -5,7 +5,7 @@ // 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 @@ -77,18 +77,18 @@ cygwin_conv_to_win32_path(const char *name, char *win32_name) 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 @@ -213,7 +213,7 @@ static int 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 @@ -229,10 +229,10 @@ statDir(const char *file, struct stat *sb) } #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 @@ -278,10 +278,10 @@ stat2(const char *file, struct stat *sb) 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 @@ -379,9 +379,9 @@ stat(const char *file, struct stat *sb) 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)) @@ -609,11 +609,11 @@ opendir(const char *path) 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 @@ -682,15 +682,15 @@ readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) _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", @@ -702,9 +702,9 @@ readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) } #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; @@ -806,15 +806,15 @@ int 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; } @@ -827,12 +827,12 @@ int 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 } @@ -841,9 +841,9 @@ char * 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 @@ -1281,10 +1281,10 @@ utime(const char *fname, struct utimbuf *times) #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, @@ -1326,10 +1326,10 @@ int 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 @@ -1402,10 +1402,10 @@ 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); - 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 diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 862e1b7186..4ffb836b51 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -4,7 +4,7 @@ // 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 diff --git a/bacula/src/wx-console/Makefile.in b/bacula/src/wx-console/Makefile.in index 452715b147..3115125c4a 100644 --- a/bacula/src/wx-console/Makefile.in +++ b/bacula/src/wx-console/Makefile.in @@ -83,7 +83,7 @@ wx-console.app: wx-console 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