From: Kern Sibbald Date: Wed, 2 May 2007 06:18:47 +0000 (+0000) Subject: kes Correct handle problem in new win32_ftruncate routine. X-Git-Tag: Release-7.0.0~6458 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c2c24bdb0d0ea4c5de53f7eb5e55c56eb1f5248e;p=bacula%2Fbacula kes Correct handle problem in new win32_ftruncate routine. kes Convert ua_purge.c and ua_update.c to use new ua class message routines for bat. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4671 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/ua_purge.c b/bacula/src/dird/ua_purge.c index c08fe06c55..9acacd363d 100644 --- a/bacula/src/dird/ua_purge.c +++ b/bacula/src/dird/ua_purge.c @@ -86,7 +86,7 @@ int purgecmd(UAContext *ua, const char *cmd) NT_("Volume"), NULL}; - bsendmsg(ua, _( + ua->warning_msg(_( "\nThis command is can be DANGEROUS!!!\n\n" "It purges (deletes) all Files from a Job,\n" "JobId, Client or Volume; or it purges (deletes)\n" @@ -196,7 +196,7 @@ static int purge_files_from_client(UAContext *ua, CLIENT *client) del.max_ids = 1000; del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids); - bsendmsg(ua, _("Begin purging files for Client \"%s\"\n"), cr.Name); + ua->info_msg(_("Begin purging files for Client \"%s\"\n"), cr.Name); Mmsg(query, select_jobsfiles_from_client, edit_int64(cr.ClientId, ed1)); Dmsg1(050, "select sql=%s\n", query.c_str()); @@ -205,10 +205,10 @@ static int purge_files_from_client(UAContext *ua, CLIENT *client) purge_files_from_job_list(ua, del); if (del.num_ids == 0) { - bsendmsg(ua, _("No Files found for client %s to purge from %s catalog.\n"), + ua->warning_msg(_("No Files found for client %s to purge from %s catalog.\n"), client->name(), client->catalog->name()); } else { - bsendmsg(ua, _("Files for %d Jobs for client \"%s\" purged from %s catalog.\n"), del.num_ids, + ua->info_msg(_("Files for %d Jobs for client \"%s\" purged from %s catalog.\n"), del.num_ids, client->name(), client->catalog->name()); } @@ -246,7 +246,7 @@ static int purge_jobs_from_client(UAContext *ua, CLIENT *client) del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids); del.PurgedFiles = (char *)malloc(del.max_ids); - bsendmsg(ua, _("Begin purging jobs from Client \"%s\"\n"), cr.Name); + ua->info_msg(_("Begin purging jobs from Client \"%s\"\n"), cr.Name); Mmsg(query, select_jobs_from_client, edit_int64(cr.ClientId, ed1)); Dmsg1(150, "select sql=%s\n", query.c_str()); @@ -255,10 +255,10 @@ static int purge_jobs_from_client(UAContext *ua, CLIENT *client) purge_job_list_from_catalog(ua, del); if (del.num_ids == 0) { - bsendmsg(ua, _("No Files found for client %s to purge from %s catalog.\n"), + ua->warning_msg(_("No Files found for client %s to purge from %s catalog.\n"), client->name(), client->catalog->name()); } else { - bsendmsg(ua, _("%d Jobs for client %s purged from %s catalog.\n"), del.num_ids, + ua->info_msg(_("%d Jobs for client %s purged from %s catalog.\n"), del.num_ids, client->name(), client->catalog->name()); } @@ -404,8 +404,7 @@ bool purge_jobs_from_volume(UAContext *ua, MEDIA_DBR *mr) strcmp(mr->VolStatus, "Used") == 0 || strcmp(mr->VolStatus, "Error") == 0; if (!stat) { - bsendmsg(ua, "\n"); - bsendmsg(ua, _("Volume \"%s\" has VolStatus \"%s\" and cannot be purged.\n" + ua->error_msg(_("\nVolume \"%s\" has VolStatus \"%s\" and cannot be purged.\n" "The VolStatus must be: Append, Full, Used, or Error to be purged.\n"), mr->VolumeName, mr->VolStatus); goto bail_out; @@ -430,7 +429,7 @@ bool purge_jobs_from_volume(UAContext *ua, MEDIA_DBR *mr) Mmsg(query, "SELECT DISTINCT JobId FROM JobMedia WHERE MediaId=%s", edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)&del)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); Dmsg0(050, "Count failed\n"); goto bail_out; } @@ -438,7 +437,7 @@ bool purge_jobs_from_volume(UAContext *ua, MEDIA_DBR *mr) purge_job_list_from_catalog(ua, del); - bsendmsg(ua, _("%d File%s on Volume \"%s\" purged from catalog.\n"), del.num_del, + ua->info_msg(_("%d File%s on Volume \"%s\" purged from catalog.\n"), del.num_del, del.num_del==1?"":"s", mr->VolumeName); purged = is_volume_purged(ua, mr); @@ -473,16 +472,16 @@ bool is_volume_purged(UAContext *ua, MEDIA_DBR *mr) Mmsg(query, "SELECT count(*) FROM JobMedia WHERE MediaId=%s", edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str(), del_count_handler, (void *)&cnt)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); Dmsg0(050, "Count failed\n"); goto bail_out; } if (cnt.count == 0) { - bsendmsg(ua, _("There are no more Jobs associated with Volume \"%s\". Marking it purged.\n"), + ua->warning_msg(_("There are no more Jobs associated with Volume \"%s\". Marking it purged.\n"), mr->VolumeName); if (!(purged = mark_media_purged(ua, mr))) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } } bail_out: @@ -520,7 +519,7 @@ bool mark_media_purged(UAContext *ua, MEDIA_DBR *mr) { /* check if destination pool size is ok */ if (newpr.MaxVols > 0 && newpr.NumVols >= newpr.MaxVols) { - bsendmsg(ua, _("Unable move recycled Volume in full " + ua->error_msg(_("Unable move recycled Volume in full " "Pool \"%s\" MaxVols=%d\n"), newpr.Name, newpr.MaxVols); @@ -528,7 +527,7 @@ bool mark_media_purged(UAContext *ua, MEDIA_DBR *mr) update_vol_pool(ua, newpr.Name, mr, &oldpr); } } else { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } } /* Send message to Job report, if it is a *real* job */ @@ -538,7 +537,7 @@ bool mark_media_purged(UAContext *ua, MEDIA_DBR *mr) } return true; } else { - bsendmsg(ua, _("Cannot purge Volume with VolStatus=%s\n"), mr->VolStatus); + ua->error_msg(_("Cannot purge Volume with VolStatus=%s\n"), mr->VolStatus); } return strcmp(mr->VolStatus, "Purged") == 0; } diff --git a/bacula/src/dird/ua_update.c b/bacula/src/dird/ua_update.c index e28c4145e5..4339735ab6 100644 --- a/bacula/src/dird/ua_update.c +++ b/bacula/src/dird/ua_update.c @@ -130,16 +130,16 @@ static void update_volstatus(UAContext *ua, const char *val, MEDIA_DBR *mr) } } if (!found) { - bsendmsg(ua, _("Invalid VolStatus specified: %s\n"), val); + ua->error_msg(_("Invalid VolStatus specified: %s\n"), val); } else { char ed1[50]; bstrncpy(mr->VolStatus, kw[i], sizeof(mr->VolStatus)); Mmsg(query, "UPDATE Media SET VolStatus='%s' WHERE MediaId=%s", mr->VolStatus, edit_int64(mr->MediaId,ed1)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New Volume status is: %s\n"), mr->VolStatus); + ua->info_msg(_("New Volume status is: %s\n"), mr->VolStatus); } } } @@ -149,15 +149,15 @@ static void update_volretention(UAContext *ua, char *val, MEDIA_DBR *mr) char ed1[150], ed2[50]; POOL_MEM query(PM_MESSAGE); if (!duration_to_utime(val, &mr->VolRetention)) { - bsendmsg(ua, _("Invalid retention period specified: %s\n"), val); + ua->error_msg(_("Invalid retention period specified: %s\n"), val); return; } Mmsg(query, "UPDATE Media SET VolRetention=%s WHERE MediaId=%s", edit_uint64(mr->VolRetention, ed1), edit_int64(mr->MediaId,ed2)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New retention period is: %s\n"), + ua->info_msg(_("New retention period is: %s\n"), edit_utime(mr->VolRetention, ed1, sizeof(ed1))); } } @@ -168,15 +168,15 @@ static void update_voluseduration(UAContext *ua, char *val, MEDIA_DBR *mr) POOL_MEM query(PM_MESSAGE); if (!duration_to_utime(val, &mr->VolUseDuration)) { - bsendmsg(ua, _("Invalid use duration specified: %s\n"), val); + ua->error_msg(_("Invalid use duration specified: %s\n"), val); return; } Mmsg(query, "UPDATE Media SET VolUseDuration=%s WHERE MediaId=%s", edit_uint64(mr->VolUseDuration, ed1), edit_int64(mr->MediaId,ed2)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New use duration is: %s\n"), + ua->info_msg(_("New use duration is: %s\n"), edit_utime(mr->VolUseDuration, ed1, sizeof(ed1))); } } @@ -188,9 +188,9 @@ static void update_volmaxjobs(UAContext *ua, char *val, MEDIA_DBR *mr) Mmsg(query, "UPDATE Media SET MaxVolJobs=%s WHERE MediaId=%s", val, edit_int64(mr->MediaId,ed1)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New max jobs is: %s\n"), val); + ua->info_msg(_("New max jobs is: %s\n"), val); } } @@ -201,9 +201,9 @@ static void update_volmaxfiles(UAContext *ua, char *val, MEDIA_DBR *mr) Mmsg(query, "UPDATE Media SET MaxVolFiles=%s WHERE MediaId=%s", val, edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New max files is: %s\n"), val); + ua->info_msg(_("New max files is: %s\n"), val); } } @@ -214,15 +214,15 @@ static void update_volmaxbytes(UAContext *ua, char *val, MEDIA_DBR *mr) POOL_MEM query(PM_MESSAGE); if (!size_to_uint64(val, strlen(val), &maxbytes)) { - bsendmsg(ua, _("Invalid max. bytes specification: %s\n"), val); + ua->error_msg(_("Invalid max. bytes specification: %s\n"), val); return; } Mmsg(query, "UPDATE Media SET MaxVolBytes=%s WHERE MediaId=%s", edit_uint64(maxbytes, ed1), edit_int64(mr->MediaId, ed2)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New Max bytes is: %s\n"), edit_uint64(maxbytes, ed1)); + ua->info_msg(_("New Max bytes is: %s\n"), edit_uint64(maxbytes, ed1)); } } @@ -233,15 +233,15 @@ static void update_volrecycle(UAContext *ua, char *val, MEDIA_DBR *mr) POOL_MEM query(PM_MESSAGE); if (!is_yesno(val, &recycle)) { - bsendmsg(ua, _("Invalid value. It must be yes or no.\n")); + ua->error_msg(_("Invalid value. It must be yes or no.\n")); return; } Mmsg(query, "UPDATE Media SET Recycle=%d WHERE MediaId=%s", recycle, edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New Recycle flag is: %s\n"), + ua->info_msg(_("New Recycle flag is: %s\n"), mr->Recycle==1?_("yes"):_("no")); } } @@ -253,15 +253,15 @@ static void update_volinchanger(UAContext *ua, char *val, MEDIA_DBR *mr) POOL_MEM query(PM_MESSAGE); if (!is_yesno(val, &InChanger)) { - bsendmsg(ua, _("Invalid value. It must be yes or no.\n")); + ua->error_msg(_("Invalid value. It must be yes or no.\n")); return; } Mmsg(query, "UPDATE Media SET InChanger=%d WHERE MediaId=%s", InChanger, edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str(), NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New InChanger flag is: %s\n"), + ua->info_msg(_("New InChanger flag is: %s\n"), mr->InChanger==1?_("yes"):_("no")); } } @@ -274,12 +274,12 @@ static void update_volslot(UAContext *ua, char *val, MEDIA_DBR *mr) memset(&pr, 0, sizeof(POOL_DBR)); pr.PoolId = mr->PoolId; if (!db_get_pool_record(ua->jcr, ua->db, &pr)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); return; } mr->Slot = atoi(val); if (pr.MaxVols > 0 && mr->Slot > (int)pr.MaxVols) { - bsendmsg(ua, _("Invalid slot, it must be between 0 and MaxVols=%d\n"), + ua->error_msg(_("Invalid slot, it must be between 0 and MaxVols=%d\n"), pr.MaxVols); return; } @@ -288,9 +288,9 @@ static void update_volslot(UAContext *ua, char *val, MEDIA_DBR *mr) * so that any Slot is handled correctly. */ if (!db_update_media_record(ua->jcr, ua->db, mr)) { - bsendmsg(ua, _("Error updating media record Slot: ERR=%s"), db_strerror(ua->db)); + ua->error_msg(_("Error updating media record Slot: ERR=%s"), db_strerror(ua->db)); } else { - bsendmsg(ua, _("New Slot is: %d\n"), mr->Slot); + ua->info_msg(_("New Slot is: %d\n"), mr->Slot); } } @@ -315,16 +315,16 @@ void update_vol_pool(UAContext *ua, char *val, MEDIA_DBR *mr, POOL_DBR *opr) edit_int64(mr->PoolId, ed1), edit_int64(mr->MediaId, ed2)); if (!db_sql_query(ua->db, query, NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New Pool is: %s\n"), pr.Name); + ua->info_msg(_("New Pool is: %s\n"), pr.Name); opr->NumVols--; if (!db_update_pool_record(ua->jcr, ua->db, opr)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } pr.NumVols++; if (!db_update_pool_record(ua->jcr, ua->db, &pr)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } } db_unlock(ua->db); @@ -352,9 +352,9 @@ void update_vol_recyclepool(UAContext *ua, char *val, MEDIA_DBR *mr) edit_int64(mr->RecyclePoolId, ed1), edit_int64(mr->MediaId, ed2)); if (!db_sql_query(ua->db, query, NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New RecyclePool is: %s\n"), pr.Name); + ua->info_msg(_("New RecyclePool is: %s\n"), pr.Name); } db_unlock(ua->db); free_pool_memory(query); @@ -375,9 +375,9 @@ static void update_vol_from_pool(UAContext *ua, MEDIA_DBR *mr) } set_pool_dbr_defaults_in_media_dbr(mr, &pr); if (!db_update_media_defaults(ua->jcr, ua->db, mr)) { - bsendmsg(ua, _("Error updating Volume record: ERR=%s"), db_strerror(ua->db)); + ua->error_msg(_("Error updating Volume record: ERR=%s"), db_strerror(ua->db)); } else { - bsendmsg(ua, _("Volume defaults updated from \"%s\" Pool record.\n"), + ua->info_msg(_("Volume defaults updated from \"%s\" Pool record.\n"), pr.Name); } } @@ -399,9 +399,9 @@ static void update_all_vols_from_pool(UAContext *ua) set_pool_dbr_defaults_in_media_dbr(&mr, &pr); mr.PoolId = pr.PoolId; if (!db_update_media_defaults(ua->jcr, ua->db, &mr)) { - bsendmsg(ua, _("Error updating Volume records: ERR=%s"), db_strerror(ua->db)); + ua->error_msg(_("Error updating Volume records: ERR=%s"), db_strerror(ua->db)); } else { - bsendmsg(ua, _("All Volume defaults updated from Pool record.\n")); + ua->info_msg(_("All Volume defaults updated from Pool record.\n")); } } @@ -412,9 +412,9 @@ static void update_volenabled(UAContext *ua, char *val, MEDIA_DBR *mr) return; } if (!db_update_media_record(ua->jcr, ua->db, mr)) { - bsendmsg(ua, _("Error updating media record Enabled: ERR=%s"), db_strerror(ua->db)); + ua->error_msg(_("Error updating media record Enabled: ERR=%s"), db_strerror(ua->db)); } else { - bsendmsg(ua, _("New Enabled is: %d\n"), mr->Enabled); + ua->info_msg(_("New Enabled is: %d\n"), mr->Enabled); } } @@ -493,7 +493,7 @@ static int update_volume(UAContext *ua) memset(&pr, 0, sizeof(POOL_DBR)); pr.PoolId = mr.PoolId; if (!db_get_pool_record(ua->jcr, ua->db, &pr)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); break; } update_vol_pool(ua, ua->argv[j], &mr, &pr); @@ -540,12 +540,12 @@ static int update_volume(UAContext *ua) if (!select_media_dbr(ua, &mr)) { /* Get Volume record */ return 0; } - bsendmsg(ua, _("Updating Volume \"%s\"\n"), mr.VolumeName); + ua->info_msg(_("Updating Volume \"%s\"\n"), mr.VolumeName); } switch (i) { case 0: /* Volume Status */ /* Modify Volume Status */ - bsendmsg(ua, _("Current Volume status is: %s\n"), mr.VolStatus); + ua->info_msg(_("Current Volume status is: %s\n"), mr.VolStatus); start_prompt(ua, _("Possible Values are:\n")); add_prompt(ua, NT_("Append")); add_prompt(ua, NT_("Archive")); @@ -563,7 +563,7 @@ static int update_volume(UAContext *ua) update_volstatus(ua, ua->cmd, &mr); break; case 1: /* Retention */ - bsendmsg(ua, _("Current retention period is: %s\n"), + ua->info_msg(_("Current retention period is: %s\n"), edit_utime(mr.VolRetention, ed1, sizeof(ed1))); if (!get_cmd(ua, _("Enter Volume Retention period: "))) { return 0; @@ -572,7 +572,7 @@ static int update_volume(UAContext *ua) break; case 2: /* Use Duration */ - bsendmsg(ua, _("Current use duration is: %s\n"), + ua->info_msg(_("Current use duration is: %s\n"), edit_utime(mr.VolUseDuration, ed1, sizeof(ed1))); if (!get_cmd(ua, _("Enter Volume Use Duration: "))) { return 0; @@ -581,7 +581,7 @@ static int update_volume(UAContext *ua) break; case 3: /* Max Jobs */ - bsendmsg(ua, _("Current max jobs is: %u\n"), mr.MaxVolJobs); + ua->info_msg(_("Current max jobs is: %u\n"), mr.MaxVolJobs); if (!get_pint(ua, _("Enter new Maximum Jobs: "))) { return 0; } @@ -589,7 +589,7 @@ static int update_volume(UAContext *ua) break; case 4: /* Max Files */ - bsendmsg(ua, _("Current max files is: %u\n"), mr.MaxVolFiles); + ua->info_msg(_("Current max files is: %u\n"), mr.MaxVolFiles); if (!get_pint(ua, _("Enter new Maximum Files: "))) { return 0; } @@ -597,7 +597,7 @@ static int update_volume(UAContext *ua) break; case 5: /* Max Bytes */ - bsendmsg(ua, _("Current value is: %s\n"), edit_uint64(mr.MaxVolBytes, ed1)); + ua->info_msg(_("Current value is: %s\n"), edit_uint64(mr.MaxVolBytes, ed1)); if (!get_cmd(ua, _("Enter new Maximum Bytes: "))) { return 0; } @@ -606,7 +606,7 @@ static int update_volume(UAContext *ua) case 6: /* Recycle */ - bsendmsg(ua, _("Current recycle flag is: %s\n"), + ua->info_msg(_("Current recycle flag is: %s\n"), mr.Recycle==1?_("yes"):_("no")); if (!get_yesno(ua, _("Enter new Recycle status: "))) { return 0; @@ -615,7 +615,7 @@ static int update_volume(UAContext *ua) break; case 7: /* Slot */ - bsendmsg(ua, _("Current Slot is: %d\n"), mr.Slot); + ua->info_msg(_("Current Slot is: %d\n"), mr.Slot); if (!get_pint(ua, _("Enter new Slot: "))) { return 0; } @@ -623,7 +623,7 @@ static int update_volume(UAContext *ua) break; case 8: /* InChanger */ - bsendmsg(ua, _("Current InChanger flag is: %d\n"), mr.InChanger); + ua->info_msg(_("Current InChanger flag is: %d\n"), mr.InChanger); if (!get_yesno(ua, _("Set InChanger flag? yes/no: "))) { return 0; } @@ -633,24 +633,24 @@ static int update_volume(UAContext *ua) * so that any Slot is handled correctly. */ if (!db_update_media_record(ua->jcr, ua->db, &mr)) { - bsendmsg(ua, _("Error updating media record Slot: ERR=%s"), db_strerror(ua->db)); + ua->error_msg(_("Error updating media record Slot: ERR=%s"), db_strerror(ua->db)); } else { - bsendmsg(ua, _("New InChanger flag is: %d\n"), mr.InChanger); + ua->info_msg(_("New InChanger flag is: %d\n"), mr.InChanger); } break; case 9: /* Volume Files */ int32_t VolFiles; - bsendmsg(ua, _("Warning changing Volume Files can result\n" + ua->warning_msg(_("Warning changing Volume Files can result\n" "in loss of data on your Volume\n\n")); - bsendmsg(ua, _("Current Volume Files is: %u\n"), mr.VolFiles); + ua->info_msg(_("Current Volume Files is: %u\n"), mr.VolFiles); if (!get_pint(ua, _("Enter new number of Files for Volume: "))) { return 0; } VolFiles = ua->pint32_val; if (VolFiles != (int)(mr.VolFiles + 1)) { - bsendmsg(ua, _("Normally, you should only increase Volume Files by one!\n")); + ua->warning_msg(_("Normally, you should only increase Volume Files by one!\n")); if (!get_yesno(ua, _("Continue? (yes/no): ")) || ua->pint32_val == 0) { break; } @@ -659,9 +659,9 @@ static int update_volume(UAContext *ua) Mmsg(query, "UPDATE Media SET VolFiles=%u WHERE MediaId=%s", VolFiles, edit_int64(mr.MediaId, ed1)); if (!db_sql_query(ua->db, query, NULL, NULL)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); } else { - bsendmsg(ua, _("New Volume Files is: %u\n"), VolFiles); + ua->info_msg(_("New Volume Files is: %u\n"), VolFiles); } free_pool_memory(query); break; @@ -670,10 +670,10 @@ static int update_volume(UAContext *ua) memset(&pr, 0, sizeof(POOL_DBR)); pr.PoolId = mr.PoolId; if (!db_get_pool_record(ua->jcr, ua->db, &pr)) { - bsendmsg(ua, "%s", db_strerror(ua->db)); + ua->error_msg("%s", db_strerror(ua->db)); return 0; } - bsendmsg(ua, _("Current Pool is: %s\n"), pr.Name); + ua->info_msg(_("Current Pool is: %s\n"), pr.Name); if (!get_cmd(ua, _("Enter new Pool name: "))) { return 0; } @@ -688,7 +688,7 @@ static int update_volume(UAContext *ua) return 1; case 13: - bsendmsg(ua, _("Current Enabled is: %d\n"), mr.Enabled); + ua->info_msg(_("Current Enabled is: %d\n"), mr.Enabled); if (!get_cmd(ua, _("Enter new Enabled: "))) { return 0; } @@ -708,9 +708,9 @@ static int update_volume(UAContext *ua) memset(&pr, 0, sizeof(POOL_DBR)); pr.PoolId = mr.RecyclePoolId; if (db_get_pool_record(ua->jcr, ua->db, &pr)) { - bsendmsg(ua, _("Current RecyclePool is: %s\n"), pr.Name); + ua->info_msg(_("Current RecyclePool is: %s\n"), pr.Name); } else { - bsendmsg(ua, _("No current RecyclePool\n")); + ua->warning_msg(_("No current RecyclePool\n")); } if (!get_cmd(ua, _("Enter new RecyclePool name: "))) { return 0; @@ -719,7 +719,7 @@ static int update_volume(UAContext *ua) return 1; default: /* Done or error */ - bsendmsg(ua, _("Selection terminated.\n")); + ua->info_msg(_("Selection terminated.\n")); return 1; } } @@ -753,14 +753,14 @@ static bool update_pool(UAContext *ua) id = db_update_pool_record(ua->jcr, ua->db, &pr); if (id <= 0) { - bsendmsg(ua, _("db_update_pool_record returned %d. ERR=%s\n"), + ua->error_msg(_("db_update_pool_record returned %d. ERR=%s\n"), id, db_strerror(ua->db)); } query = get_pool_memory(PM_MESSAGE); Mmsg(query, list_pool, edit_int64(pr.PoolId, ed1)); db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, 1, HORZ_LIST); free_pool_memory(query); - bsendmsg(ua, _("Pool DB record updated from resource.\n")); + ua->info_msg(_("Pool DB record updated from resource.\n")); return true; } diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index 9aa5a66ad4..c38104c868 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -307,8 +307,7 @@ static bool despool_data(DCR *dcr, bool commit) berrno be; Jmsg(dcr->jcr, M_ERROR, 0, _("Ftruncate spool file failed: ERR=%s\n"), be.strerror()); - Pmsg1(000, _("Bad return from ftruncate. ERR=%s\n"), be.strerror()); - ok = false; + /* Note, try continuing despite ftruncate problem */ } P(mutex); @@ -489,9 +488,9 @@ static bool write_spool_header(DCR *dcr) #endif if (ftruncate(dcr->spool_fd, pos - stat) != 0) { berrno be; - Jmsg(dcr->jcr, M_FATAL, 0, _("Ftruncate spool file failed: ERR=%s\n"), + Jmsg(dcr->jcr, M_ERROR, 0, _("Ftruncate spool file failed: ERR=%s\n"), be.strerror()); - return false; + /* Note, try continuing despite ftruncate problem */ } } if (!despool_data(dcr, false)) { @@ -531,9 +530,9 @@ static bool write_spool_data(DCR *dcr) #endif if (ftruncate(dcr->spool_fd, pos - stat - sizeof(spool_hdr)) != 0) { berrno be; - Jmsg(dcr->jcr, M_FATAL, 0, _("Ftruncate spool file failed: ERR=%s\n"), + Jmsg(dcr->jcr, M_ERROR, 0, _("Ftruncate spool file failed: ERR=%s\n"), be.strerror()); - return false; + /* Note, try continuing despite ftruncate problem */ } } if (!despool_data(dcr, false)) { diff --git a/bacula/src/version.h b/bacula/src/version.h index 9a68f9e52d..1d84bea14e 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.8" -#define BDATE "28 April 2007" -#define LSMDATE "28Apr07" +#define BDATE "02 May 2007" +#define LSMDATE "02May07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index e5095d2da1..1e763ff95d 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,10 @@ Technical notes on version 2.1 General: +02May07 +kes Correct handle problem in new win32_ftruncate routine. +kes Convert ua_purge.c and ua_update.c to use new ua class + message routines for bat. 29Apr07 kes Correct incorrect installation of LICENSE in Win32 installer. kes Display LICENSE at the beginning of the Win32 install.