[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Condor-devel] Replace sprintf overloads with formatstr
- Date: Fri, 03 Aug 2012 15:41:42 +0200
- From: Florian Weimer <fweimer@xxxxxxxxxx>
- Subject: [Condor-devel] Replace sprintf overloads with formatstr
The attached patches (against master) replace calls to the global
sprintf overloads with calls to new formatstr functions. Similarly,
MyString::[v]sprintf is renamed to MyString::[v]formatstr.
The idea is that sprintf (as an unsafe C API) stands out better after
these changes, simplifying code review and encouraging migration to
formatstr or snprintf.
The patches are mostly auto-generated, using a Clang plug-in which
examines the AST to tell the different sprintf implementations apart. I
may have missed Windows-specific code and code under #ifdef, so it is
probably best not to apply the removal patches yet.
I can regenerate the patches for other branches and change "formatstr"
to some other identifier if you want me to.
--
Florian Weimer / Red Hat Product Security Team
>From 21cd13ef8942080ca99c4ea94331d73970f86dee Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Fri, 3 Aug 2012 14:44:48 +0200
Subject: [PATCH 4/9] Add formatstr() and vformatstr() functions
These functions are intended as replacements for the global sprintf
overloads (on std::string and MyString).
---
src/condor_utils/stl_string_utils.cpp | 29 ++++++++++++++++++++++++-----
src/condor_utils/stl_string_utils.h | 2 ++
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/condor_utils/stl_string_utils.cpp b/src/condor_utils/stl_string_utils.cpp
index d8b9004..53dd16a 100644
--- a/src/condor_utils/stl_string_utils.cpp
+++ b/src/condor_utils/stl_string_utils.cpp
@@ -44,7 +44,7 @@ bool operator>=(const MyString& L, const std::string& R) { return R <= L.Value()
bool operator>=(const std::string& L, const MyString& R) { return L >= R.Value(); }
-int vsprintf(std::string& s, const char* format, va_list pargs) {
+int vformatstr(std::string& s, const char* format, va_list pargs) {
char fixbuf[STL_STRING_UTILS_FIXBUF];
const int fixlen = sizeof(fixbuf)/sizeof(fixbuf[0]);
int n;
@@ -102,10 +102,29 @@ int vsprintf(std::string& s, const char* format, va_list pargs) {
return nn;
}
+int formatstr(std::string& s, const char* format, ...) {
+ va_list args;
+ va_start(args, format);
+ int r = vformatstr(s, format, args);
+ va_end(args);
+ return r;
+}
+
+int formatstr(MyString& s, const char* format, ...) {
+ va_list args;
+ std::string t;
+ va_start(args, format);
+ // this gets me the sprintf-standard return value (# chars printed)
+ int r = vformatstr(t, format, args);
+ va_end(args);
+ assign(s, t);
+ return r;
+}
+
int sprintf(std::string& s, const char* format, ...) {
va_list args;
va_start(args, format);
- int r = vsprintf(s, format, args);
+ int r = vformatstr(s, format, args);
va_end(args);
return r;
}
@@ -115,7 +134,7 @@ int sprintf(MyString& s, const char* format, ...) {
std::string t;
va_start(args, format);
// this gets me the sprintf-standard return value (# chars printed)
- int r = vsprintf(t, format, args);
+ int r = vformatstr(t, format, args);
va_end(args);
assign(s, t);
return r;
@@ -125,7 +144,7 @@ int sprintf_cat(std::string& s, const char* format, ...) {
va_list args;
std::string t;
va_start(args, format);
- int r = vsprintf(t, format, args);
+ int r = vformatstr(t, format, args);
va_end(args);
s += t;
return r;
@@ -135,7 +154,7 @@ int sprintf_cat(MyString& s, const char* format, ...) {
va_list args;
std::string t;
va_start(args, format);
- int r = vsprintf(t, format, args);
+ int r = vformatstr(t, format, args);
va_end(args);
s += t.c_str();
return r;
diff --git a/src/condor_utils/stl_string_utils.h b/src/condor_utils/stl_string_utils.h
index fd39c43..c85bac1 100644
--- a/src/condor_utils/stl_string_utils.h
+++ b/src/condor_utils/stl_string_utils.h
@@ -32,6 +32,8 @@
// Analogous to standard sprintf(), but writes to std::string 's', and is
// memory/buffer safe.
+int formatstr(std::string& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
+int formatstr(MyString& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
int sprintf(std::string& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
int sprintf(MyString& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
--
1.7.7.6
>From 2694d304e37bd512d77bb66ce6b3aeccb0d6abd0 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Fri, 3 Aug 2012 12:22:33 +0200
Subject: [PATCH 5/9] Replace calls to global sprintf overloads with formatstr
---
src/condor_c-gahp/io_loop.cpp | 4 +-
src/condor_c-gahp/schedd_client.cpp | 40 ++--
src/condor_c-gahp/schedd_client_main.cpp | 2 +-
src/condor_collector.V6/view_server.cpp | 2 +-
.../aviary/src/AviaryJobServiceSkeleton.cpp | 4 +-
.../aviary/src/AviaryLocatorPlugin.cpp | 2 +-
.../aviary/src/AviaryScheddPlugin.cpp | 2 +-
src/condor_contrib/aviary/src/Codec.cpp | 4 +-
.../aviary/src/EndpointPublisher.cpp | 4 +-
src/condor_contrib/aviary/src/Job.cpp | 10 +-
src/condor_contrib/aviary/src/JobServerObject.cpp | 26 +-
.../aviary/src/aviary_query_server.cpp | 2 +-
src/condor_contrib/plumage/src/ODSProcessors.cpp | 35 ++--
src/condor_daemon_client/daemon.cpp | 46 ++--
src/condor_daemon_client/dc_collector.cpp | 4 +-
src/condor_daemon_client/dc_message.cpp | 4 +-
src/condor_daemon_client/dc_schedd.cpp | 14 +-
src/condor_daemon_client/dc_startd.cpp | 18 +-
src/condor_daemon_client/dc_transfer_queue.cpp | 18 +-
src/condor_daemon_core.V6/condor_lock_file.cpp | 4 +-
src/condor_daemon_core.V6/daemon_core.cpp | 2 +-
src/condor_gridmanager/baseresource.cpp | 6 +-
src/condor_gridmanager/condorjob.cpp | 24 +-
src/condor_gridmanager/condorresource.cpp | 14 +-
src/condor_gridmanager/creamjob.cpp | 52 ++--
src/condor_gridmanager/creamresource.cpp | 8 +-
src/condor_gridmanager/dcloudjob.cpp | 14 +-
src/condor_gridmanager/ec2job.cpp | 12 +-
src/condor_gridmanager/ec2resource.cpp | 2 +-
src/condor_gridmanager/gahp-client.cpp | 264 ++++++++++----------
src/condor_gridmanager/globusjob.cpp | 58 +++---
src/condor_gridmanager/globusresource.cpp | 18 +-
src/condor_gridmanager/gridmanager.cpp | 28 +-
src/condor_gridmanager/infnbatchjob.cpp | 10 +-
src/condor_gridmanager/nordugridjob.cpp | 24 +-
src/condor_gridmanager/nordugridresource.cpp | 8 +-
src/condor_gridmanager/proxymanager.cpp | 12 +-
src/condor_gridmanager/transferrequest.cpp | 12 +-
src/condor_gridmanager/unicorejob.cpp | 6 +-
src/condor_negotiator.V6/Accountant.cpp | 80 +++---
src/condor_negotiator.V6/matchmaker.cpp | 2 +-
src/condor_q.V6/queue.cpp | 2 +-
src/condor_schedd.V6/dedicated_scheduler.cpp | 2 +-
src/condor_schedd.V6/qmgmt.cpp | 6 +-
src/condor_schedd.V6/schedd.cpp | 4 +-
src/condor_startd.V6/ResAttributes.cpp | 14 +-
src/condor_startd.V6/ResMgr.cpp | 12 +-
src/condor_startd.V6/Resource.cpp | 4 +-
src/condor_status.V6/status.cpp | 8 +-
src/condor_submit.V6/submit.cpp | 4 +-
src/condor_tools/history.cpp | 8 +-
src/condor_tools/preen.cpp | 2 +-
src/condor_utils/condor_config.cpp | 2 +-
src/condor_utils/condor_event.cpp | 6 +-
src/condor_utils/dprintf_config.cpp | 4 +-
src/condor_utils/spool_version.cpp | 4 +-
src/condor_utils/user_job_policy.cpp | 8 +-
src/condor_who/who.cpp | 4 +-
src/defrag/defrag.cpp | 12 +-
src/ec2_gahp/amazongahp_common.cpp | 6 +-
60 files changed, 506 insertions(+), 507 deletions(-)
diff --git a/src/condor_c-gahp/io_loop.cpp b/src/condor_c-gahp/io_loop.cpp
index 7732b60..00e500d 100644
--- a/src/condor_c-gahp/io_loop.cpp
+++ b/src/condor_c-gahp/io_loop.cpp
@@ -257,7 +257,7 @@ main_init( int argc, char ** const argv )
else {
char * c_gahp_name = param ("CONDOR_GAHP");
ASSERT (c_gahp_name);
- sprintf(exec_name, "%s_worker_thread", c_gahp_name);
+ formatstr(exec_name, "%s_worker_thread", c_gahp_name);
free (c_gahp_name);
}
@@ -338,7 +338,7 @@ stdin_pipe_handler(Service*, int) {
if (strcasecmp (args.argv[0], GAHP_COMMAND_RESULTS) == 0) {
// Print number of results
std::string rn_buff;
- sprintf( rn_buff, "%d", result_list.number() );
+ formatstr( rn_buff, "%d", result_list.number() );
const char * commands [] = {
GAHP_RESULT_SUCCESS,
rn_buff.c_str() };
diff --git a/src/condor_c-gahp/schedd_client.cpp b/src/condor_c-gahp/schedd_client.cpp
index 32f0059..f253acb 100644
--- a/src/condor_c-gahp/schedd_client.cpp
+++ b/src/condor_c-gahp/schedd_client.cpp
@@ -134,7 +134,7 @@ doContactSchedd()
// Try connecting to schedd
DCSchedd dc_schedd ( ScheddAddr, ScheddPool );
if (dc_schedd.error() || !dc_schedd.locate()) {
- sprintf( error_msg, "Error locating schedd %s", ScheddAddr );
+ formatstr( error_msg, "Error locating schedd %s", ScheddAddr );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
@@ -262,7 +262,7 @@ doContactSchedd()
// Analyze the result ad
if (!result_ad) {
error = TRUE;
- sprintf( error_msg, "Error connecting to schedd %s %s: %s",
+ formatstr( error_msg, "Error connecting to schedd %s %s: %s",
ScheddAddr, dc_schedd.addr(), errstack.getFullText() );
}
else {
@@ -395,7 +395,7 @@ doContactSchedd()
array,
&errstack )) {
error = TRUE;
- sprintf( error_msg, "Error sending files to schedd %s: %s", ScheddAddr, errstack.getFullText() );
+ formatstr( error_msg, "Error sending files to schedd %s: %s", ScheddAddr, errstack.getFullText() );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
}
delete [] array;
@@ -456,14 +456,14 @@ doContactSchedd()
if (!dc_schedd.receiveJobSandbox( constraint.c_str(),
&errstack, &jobssent )) {
error = TRUE;
- sprintf( error_msg, "Error receiving files from schedd %s: %s",
+ formatstr( error_msg, "Error receiving files from schedd %s: %s",
ScheddAddr, errstack.getFullText() );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
}
if(error == FALSE && jobssent != jobsexpected) {
error = TRUE;
- sprintf( error_msg, "Schedd %s didn't send expected files",
+ formatstr( error_msg, "Schedd %s didn't send expected files",
ScheddAddr );
dprintf (D_ALWAYS, "Transfered files for %d jobs but got files for %d jobs. (Schedd %s with contraint %s\n", jobsexpected, jobssent, ScheddAddr, constraint.c_str());
}
@@ -537,7 +537,7 @@ doContactSchedd()
current_command->status = SchedDRequest::SDCS_COMPLETED;
if (result == false) {
- sprintf( error_msg, "Error refreshing proxy to schedd %s: %s",
+ formatstr( error_msg, "Error refreshing proxy to schedd %s: %s",
ScheddAddr, errstack.getFullText() );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
@@ -564,7 +564,7 @@ doContactSchedd()
if ((qmgr_connection = ConnectQ(dc_schedd.addr(), QMGMT_TIMEOUT, false, NULL, NULL, dc_schedd.version() )) == NULL) {
error = TRUE;
- sprintf( error_msg, "Error connecting to schedd %s", ScheddAddr );
+ formatstr( error_msg, "Error connecting to schedd %s", ScheddAddr );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
} else {
errno = 0;
@@ -610,7 +610,7 @@ doContactSchedd()
rhstr = ExprTreeToString( tree );
if( !lhstr || !rhstr) {
- sprintf( error_msg, "ERROR: ClassAd problem in Updating by constraint %s",
+ formatstr( error_msg, "ERROR: ClassAd problem in Updating by constraint %s",
current_command->constraint );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
error = TRUE;
@@ -624,7 +624,7 @@ doContactSchedd()
failure_errno = errno;
goto contact_schedd_disconnect;
}
- sprintf( error_msg, "ERROR: Failed (errno=%d) to SetAttributeByConstraint %s=%s for constraint %s",
+ formatstr( error_msg, "ERROR: Failed (errno=%d) to SetAttributeByConstraint %s=%s for constraint %s",
errno, lhstr, rhstr, current_command->constraint );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
error = TRUE;
@@ -639,7 +639,7 @@ doContactSchedd()
failure_errno = errno;
goto contact_schedd_disconnect;
}
- sprintf( error_msg, "ERROR: Failed to SetAttribute() %s=%s for job %d.%d",
+ formatstr( error_msg, "ERROR: Failed to SetAttribute() %s=%s for job %d.%d",
lhstr, rhstr, current_command->cluster_id, current_command->proc_id);
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
error = TRUE;
@@ -702,7 +702,7 @@ update_report_result:
std::string success_job_ids="";
if (qmgr_connection == NULL) {
- sprintf( error_msg, "Error connecting to schedd %s", ScheddAddr );
+ formatstr( error_msg, "Error connecting to schedd %s", ScheddAddr );
error = TRUE;
} else {
error = FALSE;
@@ -861,7 +861,7 @@ update_report_result:
if(!arglist.AppendArgsFromClassAd(current_command->classad,&arg_error_msg) ||
! arglist.InsertArgsIntoClassAd(current_command->classad,&version_info,&arg_error_msg))
{
- sprintf( error_msg,
+ formatstr( error_msg,
"ERROR: ClassAd problem in converting arguments to syntax "
"for schedd (version=%s): %s\n",
dc_schedd.version() ? dc_schedd.version() : "NULL",
@@ -873,7 +873,7 @@ update_report_result:
if(!env_obj.MergeFrom(current_command->classad,&env_error_msg) ||
!env_obj.InsertEnvIntoClassAd(current_command->classad,&env_error_msg,NULL,&version_info))
{
- sprintf( error_msg,
+ formatstr( error_msg,
"ERROR: Failed to convert environment to target syntax"
" for schedd (version %s): %s\n",
dc_schedd.version() ? dc_schedd.version() : "NULL",
@@ -908,7 +908,7 @@ update_report_result:
failure_errno = errno;
goto contact_schedd_disconnect;
}
- sprintf( error_msg, "ERROR: Failed to SetTimerAttribute %s=%ld for job %d.%d",
+ formatstr( error_msg, "ERROR: Failed to SetTimerAttribute %s=%ld for job %d.%d",
ATTR_TIMER_REMOVE_CHECK, expire_time - time(NULL), ClusterId, ProcId );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
error = TRUE;
@@ -925,7 +925,7 @@ update_report_result:
rhstr = ExprTreeToString( tree );
if( !lhstr || !rhstr) {
- sprintf( error_msg, "ERROR: ClassAd problem in Updating by constraint %s",
+ formatstr( error_msg, "ERROR: ClassAd problem in Updating by constraint %s",
current_command->constraint );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
error = TRUE;
@@ -937,7 +937,7 @@ update_report_result:
failure_errno = errno;
goto contact_schedd_disconnect;
}
- sprintf( error_msg, "ERROR: Failed to SetAttribute %s=%s for job %d.%d",
+ formatstr( error_msg, "ERROR: Failed to SetAttribute %s=%s for job %d.%d",
lhstr, rhstr, ClusterId, ProcId );
dprintf( D_ALWAYS, "%s\n", error_msg.c_str() );
error = TRUE;
@@ -1051,7 +1051,7 @@ submit_report_result:
const char ** result = new const char* [matching_ads.Length() + 3];
std::string _ad_count;
- sprintf( _ad_count, "%d", matching_ads.Length() );
+ formatstr( _ad_count, "%d", matching_ads.Length() );
int count=0;
result[count++] = GAHP_RESULT_SUCCESS;
@@ -1100,12 +1100,12 @@ submit_report_result:
if ( failure_errno == ETIMEDOUT ) {
dprintf( D_ALWAYS, "Timed out talking to schedd at line %d in "
"doContactSchedd()\n", failure_line_num );
- sprintf( error_msg, "Timed out talking to schedd" );
+ formatstr( error_msg, "Timed out talking to schedd" );
} else {
dprintf( D_ALWAYS, "Error talking to schedd at line %d in "
"doContactSchedd(), errno=%d (%s)\n", failure_line_num,
failure_errno, strerror(failure_errno) );
- sprintf( error_msg, "Error talking to schedd" );
+ formatstr( error_msg, "Error talking to schedd" );
}
command_queue.Rewind();
while (command_queue.Next(current_command)) {
@@ -1520,7 +1520,7 @@ enqueue_result (int req_id, const char ** results, const int argc)
{
std::string *buffer = new std::string();
- sprintf( *buffer, "%d", req_id );
+ formatstr( *buffer, "%d", req_id );
for ( int i = 0; i < argc; i++ ) {
*buffer += ' ';
diff --git a/src/condor_c-gahp/schedd_client_main.cpp b/src/condor_c-gahp/schedd_client_main.cpp
index 77c887a..d115fed 100644
--- a/src/condor_c-gahp/schedd_client_main.cpp
+++ b/src/condor_c-gahp/schedd_client_main.cpp
@@ -162,7 +162,7 @@ Reconfig()
char *daemon_subjects = param( "GSI_DAEMON_NAME" );
if ( daemon_subjects ) {
std::string buff;
- sprintf( buff, "%s,%s", daemon_subjects, proxySubjectName );
+ formatstr( buff, "%s,%s", daemon_subjects, proxySubjectName );
dprintf( D_ALWAYS, "Setting %s=%s\n", "GSI_DAEMON_NAME",
buff.c_str() );
// We must use our daemon subsystem prefix in case the
diff --git a/src/condor_collector.V6/view_server.cpp b/src/condor_collector.V6/view_server.cpp
index abb5bc8..cfcd903 100644
--- a/src/condor_collector.V6/view_server.cpp
+++ b/src/condor_collector.V6/view_server.cpp
@@ -166,7 +166,7 @@ void ViewServer::Config()
if (!tmp) {
EXCEPT("No POOL_HISTORY_DIR or LOCAL_DIR directory specified in config file\n");
}
- sprintf(history_dir_buf, "%s/ViewHist", tmp);
+ formatstr(history_dir_buf, "%s/ViewHist", tmp);
}
else {
history_dir_buf = tmp;
diff --git a/src/condor_contrib/aviary/src/AviaryJobServiceSkeleton.cpp b/src/condor_contrib/aviary/src/AviaryJobServiceSkeleton.cpp
index 562c0e4..8426723 100644
--- a/src/condor_contrib/aviary/src/AviaryJobServiceSkeleton.cpp
+++ b/src/condor_contrib/aviary/src/AviaryJobServiceSkeleton.cpp
@@ -100,7 +100,7 @@ buildBasicRequirements(ResourceConstraintVectorType* _constraints, string& _reqs
opsys = BASIC_WINOS_FORMAT;
}
else {
- sprintf(opsys,BASIC_OS_FORMAT,rc->getValue().c_str());
+ formatstr(opsys,BASIC_OS_FORMAT,rc->getValue().c_str());
}
break;
case ResourceConstraintType_DISK:
@@ -118,7 +118,7 @@ buildBasicRequirements(ResourceConstraintVectorType* _constraints, string& _reqs
}
}
// order is important! see BASIC_REQ_FORMAT above
- sprintf(_reqs, BASIC_REQ_FORMAT, arch.c_str(), opsys.c_str(), disk.c_str(), memory.c_str(), filesystem.c_str());
+ formatstr(_reqs, BASIC_REQ_FORMAT, arch.c_str(), opsys.c_str(), disk.c_str(), memory.c_str(), filesystem.c_str());
}
bool
diff --git a/src/condor_contrib/aviary/src/AviaryLocatorPlugin.cpp b/src/condor_contrib/aviary/src/AviaryLocatorPlugin.cpp
index c44fead..b0730a8 100644
--- a/src/condor_contrib/aviary/src/AviaryLocatorPlugin.cpp
+++ b/src/condor_contrib/aviary/src/AviaryLocatorPlugin.cpp
@@ -55,7 +55,7 @@ struct AviaryLocatorPlugin : public Service, CollectorPlugin
}
string log_name;
- sprintf(log_name,"aviary_locator.log");
+ formatstr(log_name,"aviary_locator.log");
provider = AviaryProviderFactory::create(log_name, getPoolName(),CUSTOM,LOCATOR, "services/locator/");
if (!provider) {
EXCEPT("Unable to configure AviaryProvider. Exiting...");
diff --git a/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp b/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp
index 981a2ef..d41000a 100644
--- a/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp
+++ b/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp
@@ -54,7 +54,7 @@ AviaryScheddPlugin::earlyInitialize()
if (skip) return; skip = true;
string log_name;
- sprintf(log_name,"aviary_job.log");
+ formatstr(log_name,"aviary_job.log");
string myname = "job@" + getScheddName();
provider = AviaryProviderFactory::create(log_name,myname,
"SCHEDULER","JOB","services/job/");
diff --git a/src/condor_contrib/aviary/src/Codec.cpp b/src/condor_contrib/aviary/src/Codec.cpp
index f06b24f..7791617 100644
--- a/src/condor_contrib/aviary/src/Codec.cpp
+++ b/src/condor_contrib/aviary/src/Codec.cpp
@@ -80,7 +80,7 @@ BaseCodec::addAttributeToMap (ClassAd& ad, const char* name, AttributeMapType& _
int i;
value.IsIntegerValue (i);
string i_str;
- sprintf(i_str,"%d",i);
+ formatstr(i_str,"%d",i);
_map[key] = new AviaryAttribute(AviaryAttribute::INTEGER_TYPE,i_str.c_str());
break;
}
@@ -89,7 +89,7 @@ BaseCodec::addAttributeToMap (ClassAd& ad, const char* name, AttributeMapType& _
double d;
value.IsRealValue(d);
string d_str;
- sprintf(d_str,"%f",d);
+ formatstr(d_str,"%f",d);
_map[key] = new AviaryAttribute(AviaryAttribute::FLOAT_TYPE,d_str.c_str());
break;
}
diff --git a/src/condor_contrib/aviary/src/EndpointPublisher.cpp b/src/condor_contrib/aviary/src/EndpointPublisher.cpp
index 04566b2..bf6f919 100644
--- a/src/condor_contrib/aviary/src/EndpointPublisher.cpp
+++ b/src/condor_contrib/aviary/src/EndpointPublisher.cpp
@@ -66,7 +66,7 @@ EndpointPublisher::init(const std::string& uri_suffix, bool for_ssl)
return false;
}
m_port = probe_sock.get_port();
- sprintf(port,":%d/",m_port);
+ formatstr(port,":%d/",m_port);
m_location = scheme + my_full_hostname() + port + uri_suffix;
// populate the publish ad
@@ -136,7 +136,7 @@ EndpointPublisher::invalidate()
invalidate_ad.SetTargetTypeName(ENDPOINT);
invalidate_ad.Assign(ENDPOINT_URI,m_location.c_str());
invalidate_ad.Assign(ATTR_NAME,m_name.c_str());
- sprintf(line,"%s == \"%s\"", ATTR_NAME, m_name.c_str());
+ formatstr(line,"%s == \"%s\"", ATTR_NAME, m_name.c_str());
invalidate_ad.AssignExpr(ATTR_REQUIREMENTS, line.c_str());
dprintf(D_FULLDEBUG, "EndpointPublisher sending INVALIDATE_ADS_GENERIC: '%s'\n", m_location.c_str());
diff --git a/src/condor_contrib/aviary/src/Job.cpp b/src/condor_contrib/aviary/src/Job.cpp
index 5e1afe4..fcc0d8c 100644
--- a/src/condor_contrib/aviary/src/Job.cpp
+++ b/src/condor_contrib/aviary/src/Job.cpp
@@ -453,14 +453,14 @@ void
const char* fName = m_he.file.c_str();
if ( ! ( hFile = safe_fopen_wrapper ( fName, "r" ) ) )
{
- sprintf(_text,"unable to open history file '%s'", m_he.file.c_str());
+ formatstr(_text,"unable to open history file '%s'", m_he.file.c_str());
dprintf ( D_ALWAYS, "%s\n",_text.c_str());
_ad.Assign("JOB_AD_ERROR",_text.c_str());
return;
}
if ( fseek ( hFile , m_he.start , SEEK_SET ) )
{
- sprintf(_text,"bad seek in '%s' at index %ld", m_he.file.c_str(),m_he.start);
+ formatstr(_text,"bad seek in '%s' at index %ld", m_he.file.c_str(),m_he.start);
dprintf ( D_ALWAYS, "%s\n",_text.c_str());
_ad.Assign("JOB_AD_ERROR",_text.c_str());
return;
@@ -473,21 +473,21 @@ void
// we might not have our original history file anymore
if ( error )
{
- sprintf(_text,"malformed ad for job '%s' in file '%s'",m_job->getKey(), m_he.file.c_str());
+ formatstr(_text,"malformed ad for job '%s' in file '%s'",m_job->getKey(), m_he.file.c_str());
dprintf ( D_FULLDEBUG, "%s\n", _text.c_str());
_ad.Assign("JOB_AD_ERROR",_text.c_str());
return;
}
if ( empty )
{
- sprintf(_text,"empty ad for job '%s' in '%s'", m_job->getKey(),m_he.file.c_str());
+ formatstr(_text,"empty ad for job '%s' in '%s'", m_job->getKey(),m_he.file.c_str());
dprintf ( D_FULLDEBUG,"%s\n", _text.c_str());
_ad.Assign("JOB_AD_ERROR",_text.c_str());
return;
}
if (!_ad.CopyFrom(myJobAd)) {
- sprintf(_text,"problem copying contents of history ClassAd for '%s'",m_job->getKey());
+ formatstr(_text,"problem copying contents of history ClassAd for '%s'",m_job->getKey());
dprintf ( D_ALWAYS, "%s\n",_text.c_str());
_ad.Assign("JOB_AD_ERROR",_text.c_str());
}
diff --git a/src/condor_contrib/aviary/src/JobServerObject.cpp b/src/condor_contrib/aviary/src/JobServerObject.cpp
index 6b0097f..168b240 100644
--- a/src/condor_contrib/aviary/src/JobServerObject.cpp
+++ b/src/condor_contrib/aviary/src/JobServerObject.cpp
@@ -102,7 +102,7 @@ getValidKnownJob(const char* key, AviaryStatus &_status) {
// #1: is it even a proper "cluster.proc"?
PROC_ID id = getProcByString(key);
if (id.cluster < 0 || id.proc < 0) {
- sprintf (_status.text, "Invalid job id '%s'",key);
+ formatstr (_status.text, "Invalid job id '%s'",key);
dprintf(D_FULLDEBUG, "%s\n", _status.text.c_str());
_status.type = AviaryStatus::FAIL;
return NULL;
@@ -111,7 +111,7 @@ getValidKnownJob(const char* key, AviaryStatus &_status) {
// #2 is it anywhere in our job map?
JobCollectionType::const_iterator element = g_jobs.find(key);
if ( g_jobs.end() == element ) {
- sprintf (_status.text, "Unknown local job id '%s'",key);
+ formatstr (_status.text, "Unknown local job id '%s'",key);
dprintf(D_FULLDEBUG, "%s\n", _status.text.c_str());
_status.type = AviaryStatus::NO_MATCH;
return NULL;
@@ -144,7 +144,7 @@ bool JobServerObject::getSummary(const char* key, JobSummaryFields& _summary, Av
string str;
if ( classAd.LookupString("JOB_AD_ERROR", str) )
{
- sprintf(_status.text,"Error obtaining ClassAd for job '%s'; ",key);
+ formatstr(_status.text,"Error obtaining ClassAd for job '%s'; ",key);
_status.text += str;
dprintf(D_ALWAYS,"%s\n",_status.text.c_str());
return false;
@@ -181,7 +181,7 @@ JobServerObject::getJobAd ( const char* key, AttributeMapType& _map, AviaryStatu
string str;
if ( classAd.LookupString("JOB_AD_ERROR", str) )
{
- sprintf(_status.text,"Error obtaining ClassAd for job '%s'; ",key);
+ formatstr(_status.text,"Error obtaining ClassAd for job '%s'; ",key);
_status.text += str;
dprintf(D_ALWAYS,"%s\n",_status.text.c_str());
}
@@ -189,7 +189,7 @@ JobServerObject::getJobAd ( const char* key, AttributeMapType& _map, AviaryStatu
// return all the attributes in the ClassAd
if ( !m_codec->classAdToMap ( classAd, _map ) )
{
- sprintf(_status.text,"Error mapping info for job '%s'; ",key);
+ formatstr(_status.text,"Error mapping info for job '%s'; ",key);
dprintf(D_ALWAYS,"%s\n",_status.text.c_str());
return false;
}
@@ -236,7 +236,7 @@ JobServerObject::fetchJobData(const char* key,
string str;
job->getFullAd ( ad );
if ( ad.LookupString("JOB_AD_ERROR", str) ) {
- sprintf(_status.text,"Error checking ClassAd for user priv on job '%s'; ",key);
+ formatstr(_status.text,"Error checking ClassAd for user priv on job '%s'; ",key);
_status.text += str;
dprintf(D_ALWAYS,"%s\n",_status.text.c_str());
return false;
@@ -246,28 +246,28 @@ JobServerObject::fetchJobData(const char* key,
switch (ftype) {
case ERR:
if ( !ad.LookupString(ATTR_JOB_ERROR, fname) ) {
- sprintf (_status.text, "No error file for job '%s'",key);
+ formatstr (_status.text, "No error file for job '%s'",key);
dprintf(D_ALWAYS,"%s\n", _status.text.c_str());
return false;
}
break;
case LOG:
if ( !ad.LookupString(ATTR_ULOG_FILE, fname) ) {
- sprintf (_status.text, "No log file for job '%s'",key);
+ formatstr (_status.text, "No log file for job '%s'",key);
dprintf(D_ALWAYS,"%s\n", _status.text.c_str());
return false;
}
break;
case OUT:
if ( !ad.LookupString(ATTR_JOB_OUTPUT, fname) ) {
- sprintf (_status.text, "No output file for job '%s'",key);
+ formatstr (_status.text, "No output file for job '%s'",key);
dprintf(D_ALWAYS,"%s\n", _status.text.c_str());
return false;
}
break;
default:
// ruh-roh...asking for a file type we don't know about
- sprintf (_status.text, "Unknown file type for job '%s'",key);
+ formatstr (_status.text, "Unknown file type for job '%s'",key);
dprintf(D_ALWAYS,"%s\n", _status.text.c_str());
return false;
}
@@ -276,18 +276,18 @@ JobServerObject::fetchJobData(const char* key,
StatInfo the_file(fname.c_str());
if (the_file.Error()) {
- sprintf (_status.text, "Error opening requested file '%s', error %d",fname.c_str(),the_file.Errno());
+ formatstr (_status.text, "Error opening requested file '%s', error %d",fname.c_str(),the_file.Errno());
dprintf(D_FULLDEBUG,"%s\n", _status.text.c_str());
// don't give up yet...maybe it's IWD+filename
string iwd_path;
if ( !ad.LookupString(ATTR_JOB_IWD, iwd_path) ) {
- sprintf (_status.text, "No IWD found for job '%s'",key);
+ formatstr (_status.text, "No IWD found for job '%s'",key);
dprintf(D_ALWAYS,"%s\n", _status.text.c_str());
return false;
}
StatInfo the_iwd_file(iwd_path.c_str(),fname.c_str());
if (the_iwd_file.Error()) {
- sprintf (_status.text, "No output file for job '%s'",key);
+ formatstr (_status.text, "No output file for job '%s'",key);
dprintf(D_ALWAYS,"%s\n", _status.text.c_str());
return false;
}
diff --git a/src/condor_contrib/aviary/src/aviary_query_server.cpp b/src/condor_contrib/aviary/src/aviary_query_server.cpp
index e0e74e6..490b0d5 100644
--- a/src/condor_contrib/aviary/src/aviary_query_server.cpp
+++ b/src/condor_contrib/aviary/src/aviary_query_server.cpp
@@ -72,7 +72,7 @@ void main_init(int /* argc */, char * /* argv */ [])
init_classad();
string log_name;
- sprintf(log_name,"aviary_query.log");
+ formatstr(log_name,"aviary_query.log");
string myname = "query@" + getScheddName();
provider = AviaryProviderFactory::create(log_name,myname,
"CUSTOM",QUERY_SERVER, "services/query/");
diff --git a/src/condor_contrib/plumage/src/ODSProcessors.cpp b/src/condor_contrib/plumage/src/ODSProcessors.cpp
index 974add4..388ca81 100644
--- a/src/condor_contrib/plumage/src/ODSProcessors.cpp
+++ b/src/condor_contrib/plumage/src/ODSProcessors.cpp
@@ -47,10 +47,10 @@ string formatter;
template<typename T>
const char* formatReal(T real) {
if (real == 0.0 || real == 1.0) {
- sprintf(formatter, "%.1G", real);
+ formatstr(formatter, "%.1G", real);
}
else {
- sprintf(formatter, "%.6G", real);
+ formatstr(formatter, "%.6G", real);
}
return formatter.c_str();
}
@@ -175,25 +175,25 @@ plumage::etl::processAccountantStats(ClassAd* ad, ODSMongodbOps* ops, Date_t& ts
isAcctGroup = false;
// skip stale records unless we have none
- sprintf( attrLastUsage , "LastUsageTime%d", i );
+ formatstr( attrLastUsage , "LastUsageTime%d", i );
ad->LookupInteger ( attrLastUsage.c_str(), lastUsage );
if (lastUsage < minLastUsageTime && acct_count > 0)
continue;
// parse the horrid classad
- sprintf( attrName , "Name%d", i );
- sprintf( attrPrio , "Priority%d", i );
- sprintf( attrResUsed , "ResourcesUsed%d", i );
- sprintf( attrWtResUsed , "WeightedResourcesUsed%d", i );
- sprintf( attrFactor , "PriorityFactor%d", i );
- sprintf( attrBeginUsage , "BeginUsageTime%d", i );
- sprintf( attrAccUsage , "WeightedAccumulatedUsage%d", i );
- sprintf( attrAcctGroup, "AccountingGroup%d", i);
- sprintf( attrIsAcctGroup, "IsAccountingGroup%d", i);
- sprintf( attrConfigQuota, "ConfigQuota%d", i);
- sprintf( attrEffectiveQuota, "EffectiveQuota%d", i);
- sprintf( attrSubtreeQuota, "SubtreeQuota%d", i);
- sprintf( attrSurplusPolicy, "SurplusPolicy%d", i);
+ formatstr( attrName , "Name%d", i );
+ formatstr( attrPrio , "Priority%d", i );
+ formatstr( attrResUsed , "ResourcesUsed%d", i );
+ formatstr( attrWtResUsed , "WeightedResourcesUsed%d", i );
+ formatstr( attrFactor , "PriorityFactor%d", i );
+ formatstr( attrBeginUsage , "BeginUsageTime%d", i );
+ formatstr( attrAccUsage , "WeightedAccumulatedUsage%d", i );
+ formatstr( attrAcctGroup, "AccountingGroup%d", i);
+ formatstr( attrIsAcctGroup, "IsAccountingGroup%d", i);
+ formatstr( attrConfigQuota, "ConfigQuota%d", i);
+ formatstr( attrEffectiveQuota, "EffectiveQuota%d", i);
+ formatstr( attrSubtreeQuota, "SubtreeQuota%d", i);
+ formatstr( attrSurplusPolicy, "SurplusPolicy%d", i);
ad->LookupString ( attrName.c_str(), name );
ad->LookupFloat ( attrPrio.c_str(), priority );
@@ -233,5 +233,4 @@ plumage::etl::processAccountantStats(ClassAd* ad, ODSMongodbOps* ops, Date_t& ts
conn->insert(DB_STATS_SAMPLES_ACCOUNTANT,bob.obj());
}
-
-}
\ No newline at end of file
+}
diff --git a/src/condor_daemon_client/daemon.cpp b/src/condor_daemon_client/daemon.cpp
index e2afded..2c01393 100644
--- a/src/condor_daemon_client/daemon.cpp
+++ b/src/condor_daemon_client/daemon.cpp
@@ -373,15 +373,15 @@ Daemon::idStr( void )
std::string buf;
if( _is_local ) {
ASSERT( dt_str );
- sprintf( buf, "local %s", dt_str );
+ formatstr( buf, "local %s", dt_str );
} else if( _name ) {
ASSERT( dt_str );
- sprintf( buf, "%s %s", dt_str, _name );
+ formatstr( buf, "%s %s", dt_str, _name );
} else if( _addr ) {
ASSERT( dt_str );
Sinful sinful(_addr);
sinful.clearParams(); // too much info is ugly
- sprintf( buf, "%s at %s", dt_str,
+ formatstr( buf, "%s at %s", dt_str,
sinful.getSinful() ? sinful.getSinful() : _addr );
if( _full_hostname ) {
sprintf_cat( buf, " (%s)", _full_hostname );
@@ -694,7 +694,7 @@ Daemon::sendCommand( int cmd, Sock* sock, int sec, CondorError* errstack, char c
}
if( ! sock->end_of_message() ) {
std::string err_buf;
- sprintf( err_buf, "Can't send eom for %d to %s", cmd,
+ formatstr( err_buf, "Can't send eom for %d to %s", cmd,
idStr() );
newError( CA_COMMUNICATION_ERROR, err_buf.c_str() );
return false;
@@ -712,7 +712,7 @@ Daemon::sendCommand( int cmd, Stream::stream_type st, int sec, CondorError* errs
}
if( ! tmp->end_of_message() ) {
std::string err_buf;
- sprintf( err_buf, "Can't send eom for %d to %s", cmd,
+ formatstr( err_buf, "Can't send eom for %d to %s", cmd,
idStr() );
newError( CA_COMMUNICATION_ERROR, err_buf.c_str() );
delete tmp;
@@ -1049,7 +1049,7 @@ Daemon::getDaemonInfo( AdTypes adtype, bool query_collector )
// If we were not passed a name or an addr, check the
// config file for a subsystem_HOST, e.g. SCHEDD_HOST=XXXX
if( ! _name && !_pool ) {
- sprintf( buf, "%s_HOST", _subsys );
+ formatstr( buf, "%s_HOST", _subsys );
char *specified_host = param( buf.c_str() );
if ( specified_host ) {
// Found an entry. Use this name.
@@ -1095,7 +1095,7 @@ Daemon::getDaemonInfo( AdTypes adtype, bool query_collector )
"finding IP address\n", host );
if (!get_fqdn_and_ip_from_hostname(host, fqdn, hostaddr)) {
// With a hostname, this is a fatal Daemon error.
- sprintf( buf, "unknown host %s", host );
+ formatstr( buf, "unknown host %s", host );
newError( CA_LOCATE_FAILED, buf.c_str() );
if (host) free( host );
@@ -1222,12 +1222,12 @@ Daemon::getDaemonInfo( AdTypes adtype, bool query_collector )
machine all reporting to the same collector.
-Derek Wright 2005-03-09
*/
- sprintf( buf, "%s == \"%s\"", ATTR_MACHINE, _full_hostname );
+ formatstr( buf, "%s == \"%s\"", ATTR_MACHINE, _full_hostname );
query.addANDConstraint( buf.c_str() );
} else if ( _type == DT_GENERIC ) {
query.setGenericQueryType(_subsys);
} else if ( _name ) {
- sprintf( buf, "%s == \"%s\"", ATTR_NAME, _name );
+ formatstr( buf, "%s == \"%s\"", ATTR_NAME, _name );
query.addANDConstraint( buf.c_str() );
} else {
if ( ( _type != DT_NEGOTIATOR ) && ( _type != DT_LEASE_MANAGER) ) {
@@ -1255,7 +1255,7 @@ Daemon::getDaemonInfo( AdTypes adtype, bool query_collector )
if(!scan) {
dprintf( D_ALWAYS, "Can't find address for %s %s\n",
daemonString(_type), _name ? _name : "" );
- sprintf( buf, "Can't find address for %s %s",
+ formatstr( buf, "Can't find address for %s %s",
daemonString(_type), _name ? _name : "" );
newError( CA_LOCATE_FAILED, buf.c_str() );
return false;
@@ -1339,7 +1339,7 @@ Daemon::getCmInfo( const char* subsys )
// this is just a fancy wrapper for param()...
char *hostnames = getCmHostFromConfig( subsys );
if(!hostnames) {
- sprintf( buf, "%s address or hostname not specified in config file",
+ formatstr( buf, "%s address or hostname not specified in config file",
subsys );
newError( CA_LOCATE_FAILED, buf.c_str() );
_is_configured = false;
@@ -1368,7 +1368,7 @@ Daemon::getCmInfo( const char* subsys )
}
if( ! host || !host[0]) {
- sprintf( buf, "%s address or hostname not specified in config file",
+ formatstr( buf, "%s address or hostname not specified in config file",
subsys );
newError( CA_LOCATE_FAILED, buf.c_str() );
_is_configured = false;
@@ -1396,7 +1396,7 @@ Daemon::findCmDaemon( const char* cm_name )
if( !sinful.valid() || !sinful.getHost() ) {
dprintf( D_ALWAYS, "Invalid address: %s\n", cm_name );
- sprintf( buf, "%s address or hostname not specified in config file",
+ formatstr( buf, "%s address or hostname not specified in config file",
_subsys );
newError( CA_LOCATE_FAILED, buf.c_str() );
_is_configured = false;
@@ -1441,7 +1441,7 @@ Daemon::findCmDaemon( const char* cm_name )
if ( !host ) {
- sprintf( buf, "%s address or hostname not specified in config file",
+ formatstr( buf, "%s address or hostname not specified in config file",
_subsys );
newError( CA_LOCATE_FAILED, buf.c_str() );
_is_configured = false;
@@ -1461,7 +1461,7 @@ Daemon::findCmDaemon( const char* cm_name )
int ret = get_fqdn_and_ip_from_hostname(host, fqdn, saddr);
if (!ret) {
// With a hostname, this is a fatal Daemon error.
- sprintf( buf, "unknown host %s", host );
+ formatstr( buf, "unknown host %s", host );
newError( CA_LOCATE_FAILED, buf.c_str() );
free( host );
@@ -1687,7 +1687,7 @@ Daemon::readAddressFile( const char* subsys )
MyString buf;
bool rval = false;
- sprintf( param_name, "%s_ADDRESS_FILE", subsys );
+ formatstr( param_name, "%s_ADDRESS_FILE", subsys );
addr_file = param( param_name.c_str() );
if( ! addr_file ) {
return false;
@@ -1751,7 +1751,7 @@ Daemon::readLocalClassAd( const char* subsys )
ClassAd *adFromFile;
std::string param_name;
- sprintf( param_name, "%s_DAEMON_AD_FILE", subsys );
+ formatstr( param_name, "%s_DAEMON_AD_FILE", subsys );
addr_file = param( param_name.c_str() );
if( ! addr_file ) {
return false;
@@ -1814,7 +1814,7 @@ Daemon::getInfoFromAd( const ClassAd* ad )
initStringFromAd( ad, ATTR_NAME, &_name );
// construct the IP_ADDR attribute
- sprintf( buf, "%sIpAddr", _subsys );
+ formatstr( buf, "%sIpAddr", _subsys );
if ( ad->LookupString( buf.c_str(), buf2 ) ) {
New_addr( strnewp( buf2.c_str() ) );
found_addr = true;
@@ -1833,7 +1833,7 @@ Daemon::getInfoFromAd( const ClassAd* ad )
} else {
dprintf( D_ALWAYS, "Can't find address in classad for %s %s\n",
daemonString(_type), _name ? _name : "" );
- sprintf( buf, "Can't find address in classad for %s %s",
+ formatstr( buf, "Can't find address in classad for %s %s",
daemonString(_type), _name ? _name : "" );
newError( CA_LOCATE_FAILED, buf.c_str() );
@@ -1878,7 +1878,7 @@ Daemon::initStringFromAd( const ClassAd* ad, const char* attrname, char** value
dprintf( D_ALWAYS, "Can't find %s in classad for %s %s\n",
attrname, daemonString(_type),
_name ? _name : "" );
- sprintf( buf, "Can't find %s in classad for %s %s",
+ formatstr( buf, "Can't find %s in classad for %s %s",
attrname, daemonString(_type),
_name ? _name : "" );
newError( CA_LOCATE_FAILED, buf.c_str() );
@@ -1950,7 +1950,7 @@ Daemon::New_addr( char* str )
// [TODO]
// if priv address is an IPv6 address,
// it should be <[%s]> form
- sprintf(buf,"<%s>",priv_addr);
+ formatstr(buf,"<%s>",priv_addr);
priv_addr = buf.c_str();
}
delete [] _addr;
@@ -2121,7 +2121,7 @@ getCmHostFromConfig( const char * subsys )
char* host = NULL;
// Try the config file for a subsys-specific hostname
- sprintf( buf, "%s_HOST", subsys );
+ formatstr( buf, "%s_HOST", subsys );
host = param( buf.c_str() );
if( host ) {
if( host[0] ) {
@@ -2137,7 +2137,7 @@ getCmHostFromConfig( const char * subsys )
}
// Try the config file for a subsys-specific IP addr
- sprintf( buf, "%s_IP_ADDR", subsys );
+ formatstr( buf, "%s_IP_ADDR", subsys );
host = param( buf.c_str() );
if( host ) {
if( host[0] ) {
diff --git a/src/condor_daemon_client/dc_collector.cpp b/src/condor_daemon_client/dc_collector.cpp
index 0900e1e..de388f6 100644
--- a/src/condor_daemon_client/dc_collector.cpp
+++ b/src/condor_daemon_client/dc_collector.cpp
@@ -339,7 +339,7 @@ DCCollector::sendUpdate( int cmd, ClassAd* ad1, ClassAd* ad2, bool nonblocking )
if( _port <= 0 ) {
// If it's still 0, we've got to give up and fail.
std::string err_msg;
- sprintf(err_msg, "Can't send update: invalid collector port (%d)",
+ formatstr(err_msg, "Can't send update: invalid collector port (%d)",
_port );
newError( CA_COMMUNICATION_ERROR, err_msg.c_str() );
return false;
@@ -662,7 +662,7 @@ DCCollector::initDestinationStrings( void )
// we're using (which either came from them, or is the
// default COLLECTOR_PORT if unspecified).
- sprintf(dest, "%s (port: %d)", tcp_collector_addr ? tcp_collector_addr : "", tcp_collector_port);
+ formatstr(dest, "%s (port: %d)", tcp_collector_addr ? tcp_collector_addr : "", tcp_collector_port);
tcp_update_destination = strnewp( dest.c_str() );
}
}
diff --git a/src/condor_daemon_client/dc_message.cpp b/src/condor_daemon_client/dc_message.cpp
index 0026038..38f6bfa 100644
--- a/src/condor_daemon_client/dc_message.cpp
+++ b/src/condor_daemon_client/dc_message.cpp
@@ -94,7 +94,7 @@ DCMsg::name()
m_cmd_str = getCommandString( m_cmd );
if( !m_cmd_str ) {
std::string buf;
- sprintf(buf,"command %d",m_cmd);
+ formatstr(buf,"command %d",m_cmd);
m_cmd_str = buf.c_str();
}
return m_cmd_str;
@@ -464,7 +464,7 @@ void DCMessenger::startReceiveMsg( classy_counted_ptr<DCMsg> msg, Sock *sock )
msg->setMessenger( this );
std::string name;
- sprintf(name, "DCMessenger::receiveMsgCallback %s", msg->name());
+ formatstr(name, "DCMessenger::receiveMsgCallback %s", msg->name());
incRefCount();
diff --git a/src/condor_daemon_client/dc_schedd.cpp b/src/condor_daemon_client/dc_schedd.cpp
index af1049e..062eba9 100644
--- a/src/condor_daemon_client/dc_schedd.cpp
+++ b/src/condor_daemon_client/dc_schedd.cpp
@@ -402,7 +402,7 @@ DCSchedd::receiveJobSandbox(const char* constraint, CondorError * errstack, int
if ( !rsock.end_of_message() ) {
std::string errmsg;
- sprintf(errmsg,
+ formatstr(errmsg,
"Can't send initial message (version + constraint) to schedd (%s)",
_addr);
@@ -421,7 +421,7 @@ DCSchedd::receiveJobSandbox(const char* constraint, CondorError * errstack, int
rsock.decode();
if ( !rsock.code(JobAdsArrayLen) ) {
std::string errmsg;
- sprintf(errmsg,
+ formatstr(errmsg,
"Can't receive JobAdsArrayLen from the schedd (%s)",
_addr);
@@ -450,7 +450,7 @@ DCSchedd::receiveJobSandbox(const char* constraint, CondorError * errstack, int
// grab job ClassAd
if ( !job.initFromStream(rsock) ) {
std::string errmsg;
- sprintf(errmsg, "Can't receive job ad %d from the schedd", i);
+ formatstr(errmsg, "Can't receive job ad %d from the schedd", i);
dprintf(D_ALWAYS, "DCSchedd::receiveJobSandbox: %s\n", errmsg.c_str());
@@ -672,7 +672,7 @@ DCSchedd::requestSandboxLocation(int direction,
return false;
}
- sprintf(str, "%d.%d", cluster, proc);
+ formatstr(str, "%d.%d", cluster, proc);
// make something like: 1.0, 1.1, 1.2, ....
sl.append(str.c_str());
@@ -895,7 +895,7 @@ DCSchedd::spoolJobFiles(int JobAdsArrayLen, ClassAd* JobAdsArray[], CondorError
rsock.timeout(20); // years of research... :)
if( ! rsock.connect(_addr) ) {
std::string errmsg;
- sprintf(errmsg, "Failed to connect to schedd (%s)", _addr);
+ formatstr(errmsg, "Failed to connect to schedd (%s)", _addr);
dprintf( D_ALWAYS, "DCSchedd::spoolJobFiles: %s\n", errmsg.c_str() );
@@ -958,7 +958,7 @@ DCSchedd::spoolJobFiles(int JobAdsArrayLen, ClassAd* JobAdsArray[], CondorError
if( !rsock.end_of_message() ) {
std::string errmsg;
- sprintf(errmsg,
+ formatstr(errmsg,
"Can't send initial message (version + count) to schedd (%s)",
_addr);
@@ -991,7 +991,7 @@ DCSchedd::spoolJobFiles(int JobAdsArrayLen, ClassAd* JobAdsArray[], CondorError
if( !rsock.end_of_message() ) {
std::string errmsg;
- sprintf(errmsg, "Failed while sending job ids to schedd (%s)", _addr);
+ formatstr(errmsg, "Failed while sending job ids to schedd (%s)", _addr);
dprintf(D_ALWAYS,"DCSchedd:spoolJobFiles: %s\n", errmsg.c_str());
diff --git a/src/condor_daemon_client/dc_startd.cpp b/src/condor_daemon_client/dc_startd.cpp
index d365394..717c4f4 100644
--- a/src/condor_daemon_client/dc_startd.cpp
+++ b/src/condor_daemon_client/dc_startd.cpp
@@ -971,7 +971,7 @@ DCStartd::checkVacateType( VacateType t )
case VACATE_FAST:
break;
default:
- sprintf(err_msg, "Invalid VacateType (%d)", (int)t);
+ formatstr(err_msg, "Invalid VacateType (%d)", (int)t);
newError( CA_INVALID_REQUEST, err_msg.c_str() );
return false;
}
@@ -1013,7 +1013,7 @@ DCStartd::drainJobs(int how_fast,bool resume_on_completion,char const *check_exp
ClassAd request_ad;
Sock *sock = startCommand( DRAIN_JOBS, Sock::reli_sock, 20 );
if( !sock ) {
- sprintf(error_msg,"Failed to start DRAIN_JOBS command to %s",name());
+ formatstr(error_msg,"Failed to start DRAIN_JOBS command to %s",name());
newError(CA_FAILURE,error_msg.c_str());
return false;
}
@@ -1025,7 +1025,7 @@ DCStartd::drainJobs(int how_fast,bool resume_on_completion,char const *check_exp
}
if( !request_ad.put(*sock) || !sock->end_of_message() ) {
- sprintf(error_msg,"Failed to compose DRAIN_JOBS request to %s",name());
+ formatstr(error_msg,"Failed to compose DRAIN_JOBS request to %s",name());
newError(CA_FAILURE,error_msg.c_str());
delete sock;
return false;
@@ -1034,7 +1034,7 @@ DCStartd::drainJobs(int how_fast,bool resume_on_completion,char const *check_exp
sock->decode();
ClassAd response_ad;
if( !response_ad.initFromStream(*sock) || !sock->end_of_message() ) {
- sprintf(error_msg,"Failed to get response to DRAIN_JOBS request to %s",name());
+ formatstr(error_msg,"Failed to get response to DRAIN_JOBS request to %s",name());
newError(CA_FAILURE,error_msg.c_str());
delete sock;
return false;
@@ -1049,7 +1049,7 @@ DCStartd::drainJobs(int how_fast,bool resume_on_completion,char const *check_exp
std::string remote_error_msg;
response_ad.LookupString(ATTR_ERROR_STRING,remote_error_msg);
response_ad.LookupInteger(ATTR_ERROR_CODE,error_code);
- sprintf(error_msg,
+ formatstr(error_msg,
"Received failure from %s in response to DRAIN_JOBS request: error code %d: %s",
name(),error_code,remote_error_msg.c_str());
newError(CA_FAILURE,error_msg.c_str());
@@ -1068,7 +1068,7 @@ DCStartd::cancelDrainJobs(char const *request_id)
ClassAd request_ad;
Sock *sock = startCommand( CANCEL_DRAIN_JOBS, Sock::reli_sock, 20 );
if( !sock ) {
- sprintf(error_msg,"Failed to start CANCEL_DRAIN_JOBS command to %s",name());
+ formatstr(error_msg,"Failed to start CANCEL_DRAIN_JOBS command to %s",name());
newError(CA_FAILURE,error_msg.c_str());
return false;
}
@@ -1078,7 +1078,7 @@ DCStartd::cancelDrainJobs(char const *request_id)
}
if( !request_ad.put(*sock) || !sock->end_of_message() ) {
- sprintf(error_msg,"Failed to compose CANCEL_DRAIN_JOBS request to %s",name());
+ formatstr(error_msg,"Failed to compose CANCEL_DRAIN_JOBS request to %s",name());
newError(CA_FAILURE,error_msg.c_str());
return false;
}
@@ -1086,7 +1086,7 @@ DCStartd::cancelDrainJobs(char const *request_id)
sock->decode();
ClassAd response_ad;
if( !response_ad.initFromStream(*sock) || !sock->end_of_message() ) {
- sprintf(error_msg,"Failed to get response to CANCEL_DRAIN_JOBS request to %s",name());
+ formatstr(error_msg,"Failed to get response to CANCEL_DRAIN_JOBS request to %s",name());
newError(CA_FAILURE,error_msg.c_str());
delete sock;
return false;
@@ -1099,7 +1099,7 @@ DCStartd::cancelDrainJobs(char const *request_id)
std::string remote_error_msg;
response_ad.LookupString(ATTR_ERROR_STRING,remote_error_msg);
response_ad.LookupInteger(ATTR_ERROR_CODE,error_code);
- sprintf(error_msg,
+ formatstr(error_msg,
"Received failure from %s in response to CANCEL_DRAIN_JOBS request: error code %d: %s",
name(),error_code,remote_error_msg.c_str());
newError(CA_FAILURE,error_msg.c_str());
diff --git a/src/condor_daemon_client/dc_transfer_queue.cpp b/src/condor_daemon_client/dc_transfer_queue.cpp
index 2705e64..a935999 100644
--- a/src/condor_daemon_client/dc_transfer_queue.cpp
+++ b/src/condor_daemon_client/dc_transfer_queue.cpp
@@ -50,11 +50,11 @@ TransferQueueContactInfo::TransferQueueContactInfo(char const *str) {
if( !pos ) {
EXCEPT("Invalid transfer queue contact info: %s",str);
}
- sprintf(name,"%.*s",(int)(pos-str),str);
+ formatstr(name,"%.*s",(int)(pos-str),str);
str = pos+1;
size_t len = strcspn(str,";");
- sprintf(value,"%.*s",(int)len,str);
+ formatstr(value,"%.*s",(int)len,str);
str += len;
if( *str == ';' ) {
str++;
@@ -175,7 +175,7 @@ DCTransferQueue::RequestTransferQueueSlot(bool downloading,char const *fname,cha
m_xfer_queue_sock = reliSock( timeout, 0, &errstack, false, true );
if( !m_xfer_queue_sock ) {
- sprintf(m_xfer_rejected_reason,
+ formatstr(m_xfer_rejected_reason,
"Failed to connect to transfer queue manager for job %s (%s): %s.",
jobid, fname, errstack.getFullText() );
error_desc = m_xfer_rejected_reason;
@@ -197,7 +197,7 @@ DCTransferQueue::RequestTransferQueueSlot(bool downloading,char const *fname,cha
{
delete m_xfer_queue_sock;
m_xfer_queue_sock = NULL;
- sprintf(m_xfer_rejected_reason,
+ formatstr(m_xfer_rejected_reason,
"Failed to initiate transfer queue request for job %s (%s): %s.",
jobid, fname, errstack.getFullText() );
error_desc = m_xfer_rejected_reason;
@@ -218,7 +218,7 @@ DCTransferQueue::RequestTransferQueueSlot(bool downloading,char const *fname,cha
if( !msg.put(*m_xfer_queue_sock) || !m_xfer_queue_sock->end_of_message() )
{
- sprintf(m_xfer_rejected_reason,
+ formatstr(m_xfer_rejected_reason,
"Failed to write transfer request to %s for job %s "
"(initial file %s).",
m_xfer_queue_sock->peer_description(),
@@ -275,7 +275,7 @@ DCTransferQueue::PollForTransferQueueSlot(int timeout,bool &pending,MyString &er
if( !msg.initFromStream(*m_xfer_queue_sock) ||
!m_xfer_queue_sock->end_of_message() )
{
- sprintf(m_xfer_rejected_reason,
+ formatstr(m_xfer_rejected_reason,
"Failed to receive transfer queue response from %s for job %s "
"(initial file %s).",
m_xfer_queue_sock->peer_description(),
@@ -288,7 +288,7 @@ DCTransferQueue::PollForTransferQueueSlot(int timeout,bool &pending,MyString &er
if( !msg.LookupInteger(ATTR_RESULT,result) ) {
std::string msg_str;
msg.sPrint(msg_str);
- sprintf(m_xfer_rejected_reason,
+ formatstr(m_xfer_rejected_reason,
"Invalid transfer queue response from %s for job %s (%s): %s",
m_xfer_queue_sock->peer_description(),
m_xfer_jobid.c_str(),
@@ -304,7 +304,7 @@ DCTransferQueue::PollForTransferQueueSlot(int timeout,bool &pending,MyString &er
m_xfer_queue_go_ahead = false;
std::string reason;
msg.LookupString(ATTR_ERROR_STRING,reason);
- sprintf(m_xfer_rejected_reason,
+ formatstr(m_xfer_rejected_reason,
"Request to transfer files for %s (%s) was rejected by %s: %s",
m_xfer_jobid.c_str(), m_xfer_fname.c_str(),
m_xfer_queue_sock->peer_description(),
@@ -361,7 +361,7 @@ DCTransferQueue::CheckTransferQueueSlot()
// transfer queue manager has either died or taken away our
// transfer slot.
- sprintf(m_xfer_rejected_reason,
+ formatstr(m_xfer_rejected_reason,
"Connection to transfer queue manager %s for %s has gone bad.",
m_xfer_queue_sock->peer_description(), m_xfer_fname.c_str());
dprintf(D_ALWAYS,"%s\n",m_xfer_rejected_reason.c_str());
diff --git a/src/condor_daemon_core.V6/condor_lock_file.cpp b/src/condor_daemon_core.V6/condor_lock_file.cpp
index c870077..b14d5dd 100644
--- a/src/condor_daemon_core.V6/condor_lock_file.cpp
+++ b/src/condor_daemon_core.V6/condor_lock_file.cpp
@@ -129,14 +129,14 @@ CondorLockFile::BuildLock( const char *l_url,
this->lock_name = l_name;
// Create the lock file name from it
- sprintf( lock_file, "%s/%s.lock", l_url + 5, l_name );
+ formatstr( lock_file, "%s/%s.lock", l_url + 5, l_name );
// Build a temporary file name
char hostname[128];
if ( condor_gethostname( hostname, sizeof( hostname ) ) ) {
sprintf( hostname, "unknown-%d", rand( ) );
}
- sprintf( temp_file, "%s.%s-%d", lock_file.c_str(), hostname, getpid( ) );
+ formatstr( temp_file, "%s.%s-%d", lock_file.c_str(), hostname, getpid( ) );
dprintf( D_FULLDEBUG, "HA Lock Init: lock file='%s'\n",
lock_file.c_str() );
diff --git a/src/condor_daemon_core.V6/daemon_core.cpp b/src/condor_daemon_core.V6/daemon_core.cpp
index 037fca8..477c06f 100644
--- a/src/condor_daemon_core.V6/daemon_core.cpp
+++ b/src/condor_daemon_core.V6/daemon_core.cpp
@@ -8907,7 +8907,7 @@ int DaemonCore::HandleChildAliveCommand(int, Stream* stream)
last_email = time(NULL);
std::string subject;
- sprintf(subject,"Condor process reports long locking delays!");
+ formatstr(subject,"Condor process reports long locking delays!");
FILE *mailer = email_admin_open(subject.c_str());
if( mailer ) {
diff --git a/src/condor_gridmanager/baseresource.cpp b/src/condor_gridmanager/baseresource.cpp
index 93433f9..6a27ac4 100644
--- a/src/condor_gridmanager/baseresource.cpp
+++ b/src/condor_gridmanager/baseresource.cpp
@@ -104,7 +104,7 @@ void BaseResource::Reconfig()
setProbeInterval( tmp_int );
jobLimit = -1;
- sprintf( param_name, "GRIDMANAGER_MAX_SUBMITTED_JOBS_PER_RESOURCE_%s",
+ formatstr( param_name, "GRIDMANAGER_MAX_SUBMITTED_JOBS_PER_RESOURCE_%s",
ResourceType() );
param_value = param( param_name.c_str() );
if ( param_value == NULL ) {
@@ -173,7 +173,7 @@ bool BaseResource::Invalidate () {
/* We only want to invalidate this resource. Using the tuple
(HashName,SchedName,Owner) as unique id. */
std::string line;
- sprintf( line,
+ formatstr( line,
"((TARGET.%s =?= \"%s\") && (TARGET.%s =?= \"%s\") && "
"(TARGET.%s =?= \"%s\") && (TARGET.%s =?= \"%s\"))",
ATTR_HASH_NAME, GetHashName (),
@@ -251,7 +251,7 @@ void BaseResource::PublishResourceAd( ClassAd *resource_ad )
{
std::string buff;
- sprintf( buff, "%s %s", ResourceType(), resourceName );
+ formatstr( buff, "%s %s", ResourceType(), resourceName );
resource_ad->Assign( ATTR_NAME, buff.c_str() );
resource_ad->Assign( "HashName", GetHashName() );
resource_ad->Assign( ATTR_SCHEDD_NAME, ScheddName );
diff --git a/src/condor_gridmanager/condorjob.cpp b/src/condor_gridmanager/condorjob.cpp
index 6f25736..1d99448 100644
--- a/src/condor_gridmanager/condorjob.cpp
+++ b/src/condor_gridmanager/condorjob.cpp
@@ -221,7 +221,7 @@ CondorJob::CondorJob( ClassAd *classad )
token = GetNextToken( " ", false );
if ( !token || strcasecmp( token, "condor" ) ) {
- sprintf( error_string, "%s not of type condor",
+ formatstr( error_string, "%s not of type condor",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -230,7 +230,7 @@ CondorJob::CondorJob( ClassAd *classad )
if ( token && *token ) {
remoteScheddName = strdup( token );
} else {
- sprintf( error_string, "%s missing schedd name",
+ formatstr( error_string, "%s missing schedd name",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -239,13 +239,13 @@ CondorJob::CondorJob( ClassAd *classad )
if ( token && *token ) {
remotePoolName = strdup( token );
} else {
- sprintf( error_string, "%s missing pool name",
+ formatstr( error_string, "%s missing pool name",
ATTR_GRID_RESOURCE );
goto error_exit;
}
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -268,7 +268,7 @@ CondorJob::CondorJob( ClassAd *classad )
}
submitterId = strdup( buff );
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GLOBAL_JOB_ID );
goto error_exit;
}
@@ -450,7 +450,7 @@ void CondorJob::doEvaluateState()
int tmp_int = 0;
ClassAd **status_ads = NULL;
std::string constraint;
- sprintf( constraint, "%s==%d&&%s==%d", ATTR_CLUSTER_ID,
+ formatstr( constraint, "%s==%d&&%s==%d", ATTR_CLUSTER_ID,
remoteJobId.cluster, ATTR_PROC_ID,
remoteJobId.proc );
rc = gahp->condor_job_status_constrained( remoteScheddName,
@@ -874,7 +874,7 @@ void CondorJob::doEvaluateState()
int num_ads;
ClassAd **status_ads = NULL;
std::string constraint;
- sprintf( constraint, "%s==%d&&%s==%d", ATTR_CLUSTER_ID,
+ formatstr( constraint, "%s==%d&&%s==%d", ATTR_CLUSTER_ID,
remoteJobId.cluster, ATTR_PROC_ID,
remoteJobId.proc );
rc = gahp->condor_job_status_constrained( remoteScheddName,
@@ -1076,7 +1076,7 @@ void CondorJob::doEvaluateState()
// TODO: Let our action here be dictated by the user preference
// expressed in the job ad.
if( remoteJobId.cluster != 0 ) {
- sprintf( errorString, "Internal error: Attempting to clear "
+ formatstr( errorString, "Internal error: Attempting to clear "
"request, but remoteJobId.cluster(%d) "
"!= 0, condorState is %s (%d)",
remoteJobId.cluster,
@@ -1225,7 +1225,7 @@ void CondorJob::SetRemoteJobId( const char *job_id )
return;
}
- sprintf( full_job_id, "condor %s %s %s", remoteScheddName,
+ formatstr( full_job_id, "condor %s %s %s", remoteScheddName,
remotePoolName, job_id );
} else {
remoteJobId.cluster = 0;
@@ -1511,7 +1511,7 @@ ClassAd *CondorJob::buildSubmitAd()
output_remaps.c_str() );
}
- sprintf( expr, "%s = %s == %d", ATTR_JOB_LEAVE_IN_QUEUE, ATTR_JOB_STATUS,
+ formatstr( expr, "%s = %s == %d", ATTR_JOB_LEAVE_IN_QUEUE, ATTR_JOB_STATUS,
COMPLETED );
if ( jobAd->LookupInteger( ATTR_JOB_LEASE_EXPIRATION, tmp_int ) ) {
@@ -1521,11 +1521,11 @@ ClassAd *CondorJob::buildSubmitAd()
submit_ad->Insert( expr.c_str() );
- sprintf( expr, "%s = Undefined", ATTR_OWNER );
+ formatstr( expr, "%s = Undefined", ATTR_OWNER );
submit_ad->Insert( expr.c_str() );
const int STAGE_IN_TIME_LIMIT = 60 * 60 * 8; // 8 hours in seconds.
- sprintf( expr, "%s = (%s > 0) =!= True && time() > %s + %d",
+ formatstr( expr, "%s = (%s > 0) =!= True && time() > %s + %d",
ATTR_PERIODIC_REMOVE_CHECK, ATTR_STAGE_IN_FINISH,
ATTR_Q_DATE, STAGE_IN_TIME_LIMIT );
submit_ad->Insert( expr.c_str() );
diff --git a/src/condor_gridmanager/condorresource.cpp b/src/condor_gridmanager/condorresource.cpp
index b27e0e0..4ace6be 100644
--- a/src/condor_gridmanager/condorresource.cpp
+++ b/src/condor_gridmanager/condorresource.cpp
@@ -44,7 +44,7 @@ const char *CondorResource::HashName( const char *resource_name,
{
static std::string hash_name;
- sprintf( hash_name, "condor %s %s#%s", resource_name,
+ formatstr( hash_name, "condor %s %s#%s", resource_name,
pool_name ? pool_name : "NULL",
proxy_subject ? proxy_subject : "NULL" );
@@ -116,7 +116,7 @@ CondorResource::CondorResource( const char *resource_name, const char *pool_name
// a gahp server can handle multiple schedds
std::string buff;
ArgList args;
- sprintf( buff, "CONDOR/%s/%s/%s", poolName ? poolName : "NULL",
+ formatstr( buff, "CONDOR/%s/%s/%s", poolName ? poolName : "NULL",
scheddName, proxyFQAN ? proxyFQAN : "NULL" );
args.AppendArg("-f");
args.AppendArg("-s");
@@ -211,7 +211,7 @@ void CondorResource::PublishResourceAd( ClassAd *resource_ad )
std::string buff;
- sprintf( buff, "condor %s %s", resourceName, poolName );
+ formatstr( buff, "condor %s %s", resourceName, poolName );
resource_ad->Assign( ATTR_NAME, buff.c_str() );
if ( proxySubject ) {
resource_ad->Assign( ATTR_X509_USER_PROXY_SUBJECT, proxySubject );
@@ -228,7 +228,7 @@ void CondorResource::RegisterJob( CondorJob *job, const char *submitter_id )
if ( submitter_ids.contains( submitter_id ) == false ) {
submitter_ids.append( submitter_id );
if ( submitter_constraint.empty() ) {
- sprintf( submitter_constraint, "(%s=?=\"%s\")",
+ formatstr( submitter_constraint, "(%s=?=\"%s\")",
ATTR_SUBMITTER_ID,
submitter_id );
} else {
@@ -330,7 +330,7 @@ void CondorResource::DoScheddPoll()
}
}
- sprintf( constraint, "(%s)", submitter_constraint.c_str() );
+ formatstr( constraint, "(%s)", submitter_constraint.c_str() );
rc = gahp->condor_job_status_constrained( scheddName,
constraint.c_str(),
@@ -383,7 +383,7 @@ void CondorResource::DoScheddPoll()
status_ads[i]->LookupInteger( ATTR_CLUSTER_ID, cluster );
status_ads[i]->LookupInteger( ATTR_PROC_ID, proc );
- sprintf( job_id_string, "condor %s %s %d.%d", scheddName,
+ formatstr( job_id_string, "condor %s %s %d.%d", scheddName,
poolName, cluster, proc );
rc2 = BaseJob::JobsByRemoteId.lookup( HashKey( job_id_string.c_str() ),
@@ -514,7 +514,7 @@ dprintf( D_FULLDEBUG, "*** Lease udpate succeeded!\n" );
std::string id_str;
updated.Rewind();
while ( updated.Next( curr_id ) ) {
- sprintf( id_str, "condor %s %s %d.%d", scheddName, poolName,
+ formatstr( id_str, "condor %s %s %d.%d", scheddName, poolName,
curr_id.cluster, curr_id.proc );
if ( BaseJob::JobsByRemoteId.lookup( HashKey( id_str.c_str() ),
curr_job ) == 0 ) {
diff --git a/src/condor_gridmanager/creamjob.cpp b/src/condor_gridmanager/creamjob.cpp
index 5ac6ba6..8305a89 100644
--- a/src/condor_gridmanager/creamjob.cpp
+++ b/src/condor_gridmanager/creamjob.cpp
@@ -248,7 +248,7 @@ CreamJob::CreamJob( ClassAd *classad )
(TimerHandlercpp)&CreamJob::ProxyCallback, this );
if ( jobProxy == NULL ) {
if ( error_string == "" ) {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_X509_USER_PROXY );
}
dprintf(D_ALWAYS, "errorstring %s\n", error_string.c_str());
@@ -284,7 +284,7 @@ CreamJob::CreamJob( ClassAd *classad )
token = GetNextToken( " ", false );
if ( !token || strcasecmp( token, "cream" ) ) {
- sprintf( error_string, "%s not of type cream", ATTR_GRID_RESOURCE );
+ formatstr( error_string, "%s not of type cream", ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -297,11 +297,11 @@ CreamJob::CreamJob( ClassAd *classad )
resourceManagerString = strdup( token );
} else {
std::string urlbuf;
- sprintf( urlbuf, "https://%s", token );
+ formatstr( urlbuf, "https://%s", token );
resourceManagerString = strdup( urlbuf.c_str() );
}
} else {
- sprintf( error_string, "%s missing CREAM Service URL",
+ formatstr( error_string, "%s missing CREAM Service URL",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -310,7 +310,7 @@ CreamJob::CreamJob( ClassAd *classad )
if ( token && *token ) {
resourceBatchSystemString = strdup( token );
} else {
- sprintf( error_string, "%s missing batch system (LRMS) type.",
+ formatstr( error_string, "%s missing batch system (LRMS) type.",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -319,13 +319,13 @@ CreamJob::CreamJob( ClassAd *classad )
if ( token && *token ) {
resourceQueueString = strdup( token );
} else {
- sprintf( error_string, "%s missing LRMS queue name.",
+ formatstr( error_string, "%s missing LRMS queue name.",
ATTR_GRID_RESOURCE );
goto error_exit;
}
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -1504,7 +1504,7 @@ char *CreamJob::buildSubmitAd()
//ARGUMENTS
if (jobAd->LookupString(ATTR_JOB_ARGUMENTS1, tmp_str)) {
- sprintf(buf, "%s = \"%s\"", ATTR_ARGS, tmp_str.c_str());
+ formatstr(buf, "%s = \"%s\"", ATTR_ARGS, tmp_str.c_str());
submitAd.Insert(buf.c_str());
}
@@ -1588,15 +1588,15 @@ char *CreamJob::buildSubmitAd()
// TODO This needs to be extracted from the VOMS extension in the
// job's credential.
// sprintf(buf, "%s = \"%s\"", ATTR_VIR_ORG, "");
- sprintf(buf, "%s = \"%s\"", ATTR_VIR_ORG, "ignored");
+ formatstr(buf, "%s = \"%s\"", ATTR_VIR_ORG, "ignored");
submitAd.Insert(buf.c_str());
//BATCHSYSTEM
- sprintf(buf, "%s = \"%s\"", ATTR_BATCH_SYSTEM, resourceBatchSystemString);
+ formatstr(buf, "%s = \"%s\"", ATTR_BATCH_SYSTEM, resourceBatchSystemString);
submitAd.Insert(buf.c_str());
//QUEUENAME
- sprintf(buf, "%s = \"%s\"", ATTR_QUEUE_NAME, resourceQueueString);
+ formatstr(buf, "%s = \"%s\"", ATTR_QUEUE_NAME, resourceQueueString);
submitAd.Insert(buf.c_str());
submitAd.Assign("outputsandboxbasedesturi", "gsiftp://localhost");
@@ -1614,7 +1614,7 @@ char *CreamJob::buildSubmitAd()
//INPUT SANDBOX
if (isb.number() > 0) {
- sprintf(buf, "%s = {", ATTR_INPUT_SB);
+ formatstr(buf, "%s = {", ATTR_INPUT_SB);
isb.rewind();
for (int i = 0; i < isb.number(); i++) {
if (i == 0)
@@ -1630,7 +1630,7 @@ char *CreamJob::buildSubmitAd()
//OUTPUT SANDBOX
if (osb.number() > 0) {
- sprintf(buf, "%s = {", ATTR_OUTPUT_SB);
+ formatstr(buf, "%s = {", ATTR_OUTPUT_SB);
osb.rewind();
for (int i = 0; i < osb.number(); i++) {
if (i == 0)
@@ -1650,14 +1650,14 @@ char *CreamJob::buildSubmitAd()
if(!envobj.MergeFrom(jobAd,&env_errors)) {
dprintf(D_ALWAYS,"(%d.%d) Failed to read job environment: %s\n",
procID.cluster, procID.proc, env_errors.Value());
- sprintf(errorString,"Failed to read job environment: %s\n",
+ formatstr(errorString,"Failed to read job environment: %s\n",
env_errors.Value());
return NULL;
}
char **env_vec = envobj.getStringArray();
if ( env_vec[0] ) {
- sprintf( buf, "%s = {", ATTR_JOB_ENVIRONMENT2 );
+ formatstr( buf, "%s = {", ATTR_JOB_ENVIRONMENT2 );
for ( int i = 0; env_vec[i]; i++ ) {
if ( i == 0 ) {
@@ -1706,7 +1706,7 @@ std::string CreamJob::getFullJobId(const char * resourceManager, const char * jo
ASSERT(resourceManager);
ASSERT(job_id);
std::string full_job_id;
- sprintf( full_job_id, "cream %s %s", resourceManager, job_id );
+ formatstr( full_job_id, "cream %s %s", resourceManager, job_id );
return full_job_id;
}
@@ -1737,7 +1737,7 @@ TransferRequest *CreamJob::MakeStageInRequest()
tmp_str2 = "file://" + tmp_str;
local_urls.insert(tmp_str2.c_str());
- sprintf( tmp_str2, "%s/%s", uploadUrl,
+ formatstr( tmp_str2, "%s/%s", uploadUrl,
condor_basename( tmp_str.c_str() ) );
remote_urls.insert( tmp_str2.c_str() );
}
@@ -1755,7 +1755,7 @@ TransferRequest *CreamJob::MakeStageInRequest()
local_urls.insert( tmp_str2.c_str() );
- sprintf( tmp_str2, "%s/%s", uploadUrl,
+ formatstr( tmp_str2, "%s/%s", uploadUrl,
condor_basename( tmp_str.c_str() ) );
remote_urls.insert( tmp_str2.c_str() );
}
@@ -1775,7 +1775,7 @@ TransferRequest *CreamJob::MakeStageInRequest()
local_urls.insert( tmp_str2.c_str() );
- sprintf( tmp_str2, "%s/%s", uploadUrl,
+ formatstr( tmp_str2, "%s/%s", uploadUrl,
condor_basename( tmp_str.c_str() ) );
remote_urls.insert( tmp_str2.c_str() );
}
@@ -1814,16 +1814,16 @@ TransferRequest *CreamJob::MakeStageOutRequest()
output_files.rewind();
while ( (filename = output_files.next()) != NULL ) {
- sprintf( buf, "%s/%s", downloadUrl, filename );
+ formatstr( buf, "%s/%s", downloadUrl, filename );
remote_urls.insert( buf.c_str() );
if ( remaps && filename_remap_find( remaps, filename,
new_name ) ) {
- sprintf( buf, "%s%s",
+ formatstr( buf, "%s%s",
new_name[0] == '/' ? "file://" : iwd_str.c_str(),
new_name.Value() );
} else {
- sprintf( buf, "%s%s",
+ formatstr( buf, "%s%s",
iwd_str.c_str(),
condor_basename( filename ) );
}
@@ -1839,11 +1839,11 @@ TransferRequest *CreamJob::MakeStageOutRequest()
jobAd->LookupBool(ATTR_TRANSFER_OUTPUT, result);
if (result) {
- sprintf( buf, "%s/%s", downloadUrl,
+ formatstr( buf, "%s/%s", downloadUrl,
condor_basename( tmp_str.c_str() ) );
remote_urls.insert( buf.c_str() );
- sprintf( buf, "%s%s",
+ formatstr( buf, "%s%s",
tmp_str[0] == '/' ? "file://" : iwd_str.c_str(),
tmp_str.c_str());
@@ -1858,11 +1858,11 @@ TransferRequest *CreamJob::MakeStageOutRequest()
jobAd->LookupBool( ATTR_TRANSFER_ERROR, result );
if ( result ) {
- sprintf( buf, "%s/%s", downloadUrl,
+ formatstr( buf, "%s/%s", downloadUrl,
condor_basename( tmp_str.c_str() ) );
remote_urls.insert( buf.c_str() );
- sprintf( buf, "%s%s",
+ formatstr( buf, "%s%s",
tmp_str[0] == '/' ? "file://" : iwd_str.c_str(),
tmp_str.c_str() );
diff --git a/src/condor_gridmanager/creamresource.cpp b/src/condor_gridmanager/creamresource.cpp
index d1d35aa..307d701 100644
--- a/src/condor_gridmanager/creamresource.cpp
+++ b/src/condor_gridmanager/creamresource.cpp
@@ -205,7 +205,7 @@ bool CreamResource::Init()
// TODO This assumes that at least one CreamJob has already
// initialized the gahp server. Need a better solution.
std::string gahp_name;
- sprintf( gahp_name, "CREAM/%s/%s", proxySubject, proxyFirstFQAN );
+ formatstr( gahp_name, "CREAM/%s/%s", proxySubject, proxyFirstFQAN );
gahp = new GahpClient( gahp_name.c_str() );
@@ -243,7 +243,7 @@ bool CreamResource::Init()
pool_name = strdup( "NoPool" );
}
- sprintf( m_leaseId, "Condor#%s#%s#%s", myUserName, ScheddName, pool_name );
+ formatstr( m_leaseId, "Condor#%s#%s#%s", myUserName, ScheddName, pool_name );
free( pool_name );
@@ -294,7 +294,7 @@ const char *CreamResource::HashName( const char *resource_name,
{
static std::string hash_name;
- sprintf( hash_name, "cream %s#%s#%s", resource_name, proxy_subject,
+ formatstr( hash_name, "cream %s#%s#%s", resource_name, proxy_subject,
proxy_first_fqan );
return hash_name.c_str();
@@ -512,7 +512,7 @@ dprintf(D_FULLDEBUG," new delegation\n");
#else
struct timeval tv;
gettimeofday( &tv, NULL );
- sprintf( delegation_uri, "%d.%d", (int)tv.tv_sec, (int)tv.tv_usec );
+ formatstr( delegation_uri, "%d.%d", (int)tv.tv_sec, (int)tv.tv_usec );
#endif
}
diff --git a/src/condor_gridmanager/dcloudjob.cpp b/src/condor_gridmanager/dcloudjob.cpp
index 1fe1892..a8602e6 100644
--- a/src/condor_gridmanager/dcloudjob.cpp
+++ b/src/condor_gridmanager/dcloudjob.cpp
@@ -182,7 +182,7 @@ DCloudJob::DCloudJob( ClassAd *classad )
token = str.GetNextToken( " ", false );
if ( !token || strcasecmp( token, "deltacloud" ) ) {
- sprintf( error_string, "%s not of type deltacloud",
+ formatstr( error_string, "%s not of type deltacloud",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -191,23 +191,23 @@ DCloudJob::DCloudJob( ClassAd *classad )
if ( token ) {
m_serviceUrl = strdup( token );
} else {
- sprintf( error_string, "%s missing Deltacloud service URL",
+ formatstr( error_string, "%s missing Deltacloud service URL",
ATTR_GRID_RESOURCE );
}
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GRID_RESOURCE );
goto error_exit;
}
if ( !jobAd->LookupString( ATTR_DELTACLOUD_USERNAME, &m_username ) ) {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_DELTACLOUD_USERNAME );
goto error_exit;
}
if ( !jobAd->LookupString( ATTR_DELTACLOUD_PASSWORD_FILE, &m_password ) ) {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_DELTACLOUD_PASSWORD_FILE );
goto error_exit;
}
@@ -217,7 +217,7 @@ DCloudJob::DCloudJob( ClassAd *classad )
// only fail if no imageid && no
if ( !jobAd->LookupString( ATTR_DELTACLOUD_IMAGE_ID, &m_imageId ) && m_instanceName == NULL) {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_DELTACLOUD_IMAGE_ID );
goto error_exit;
}
@@ -240,7 +240,7 @@ DCloudJob::DCloudJob( ClassAd *classad )
token = str.GetNextToken( " ", false );
if ( !token || strcasecmp( token, "deltacloud" ) ) {
- sprintf( error_string, "%s not of type deltacloud",
+ formatstr( error_string, "%s not of type deltacloud",
ATTR_GRID_JOB_ID );
goto error_exit;
}
diff --git a/src/condor_gridmanager/ec2job.cpp b/src/condor_gridmanager/ec2job.cpp
index b686ea3..5ac4bba 100644
--- a/src/condor_gridmanager/ec2job.cpp
+++ b/src/condor_gridmanager/ec2job.cpp
@@ -220,7 +220,7 @@ dprintf( D_ALWAYS, "================================> EC2Job::EC2Job 1 \n");
token = GetNextToken( " ", false );
if ( !token || strcasecmp( token, "ec2" ) ) {
- sprintf( error_string, "%s not of type ec2",
+ formatstr( error_string, "%s not of type ec2",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -229,13 +229,13 @@ dprintf( D_ALWAYS, "================================> EC2Job::EC2Job 1 \n");
if ( token && *token ) {
m_serviceUrl = token;
} else {
- sprintf( error_string, "%s missing EC2 service URL",
+ formatstr( error_string, "%s missing EC2 service URL",
ATTR_GRID_RESOURCE );
goto error_exit;
}
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -294,7 +294,7 @@ dprintf( D_ALWAYS, "================================> EC2Job::EC2Job 1 \n");
token = GetNextToken( " ", false );
if ( !token || strcasecmp( token, "ec2" ) ) {
- sprintf( error_string, "%s not of type ec2", ATTR_GRID_JOB_ID );
+ formatstr( error_string, "%s not of type ec2", ATTR_GRID_JOB_ID );
goto error_exit;
}
@@ -1079,7 +1079,7 @@ void EC2Job::SetRemoteJobId( const char *client_token, const char *instance_id )
{
string full_job_id;
if ( client_token && client_token[0] ) {
- sprintf( full_job_id, "ec2 %s %s", m_serviceUrl.c_str(), client_token );
+ formatstr( full_job_id, "ec2 %s %s", m_serviceUrl.c_str(), client_token );
if ( instance_id && instance_id[0] ) {
sprintf_cat( full_job_id, " %s", instance_id );
}
@@ -1151,7 +1151,7 @@ std::string EC2Job::build_keypair()
jobAd->LookupString( ATTR_GLOBAL_JOB_ID, job_id );
std::string key_pair;
- sprintf( key_pair, "SSH_%s_%s", pool_name, job_id.c_str() );
+ formatstr( key_pair, "SSH_%s_%s", pool_name, job_id.c_str() );
free( pool_name );
return key_pair;
diff --git a/src/condor_gridmanager/ec2resource.cpp b/src/condor_gridmanager/ec2resource.cpp
index abc7c16..8fdd616 100644
--- a/src/condor_gridmanager/ec2resource.cpp
+++ b/src/condor_gridmanager/ec2resource.cpp
@@ -34,7 +34,7 @@ const char * EC2Resource::HashName( const char * resource_name,
const char * public_key_file, const char * private_key_file )
{
static std::string hash_name;
- sprintf( hash_name, "ec2 %s#%s#%s", resource_name, public_key_file, private_key_file );
+ formatstr( hash_name, "ec2 %s#%s#%s", resource_name, public_key_file, private_key_file );
return hash_name.c_str();
}
diff --git a/src/condor_gridmanager/gahp-client.cpp b/src/condor_gridmanager/gahp-client.cpp
index 48c6b15..98be85e 100644
--- a/src/condor_gridmanager/gahp-client.cpp
+++ b/src/condor_gridmanager/gahp-client.cpp
@@ -238,7 +238,7 @@ GahpServer::write_line(const char *command)
if ( logGahpIo ) {
std::string debug = command;
- sprintf( debug, "'%s'", command );
+ formatstr( debug, "'%s'", command );
if ( logGahpIoSize > 0 && debug.length() > logGahpIoSize ) {
debug.erase( logGahpIoSize, std::string::npos );
debug += "...";
@@ -269,9 +269,9 @@ GahpServer::write_line(const char *command, int req, const char *args)
if ( logGahpIo ) {
std::string debug = command;
if ( args ) {
- sprintf( debug, "'%s%s%s'", command, buf, args );
+ formatstr( debug, "'%s%s%s'", command, buf, args );
} else {
- sprintf( debug, "'%s%s'", command, buf );
+ formatstr( debug, "'%s%s'", command, buf );
}
if ( logGahpIoSize > 0 && debug.length() > logGahpIoSize ) {
debug.erase( logGahpIoSize, std::string::npos );
@@ -303,7 +303,7 @@ GahpServer::Reaper(Service *,int pid,int status)
std::string buf;
- sprintf( buf, "Gahp Server (pid=%d) ", pid );
+ formatstr( buf, "Gahp Server (pid=%d) ", pid );
if( WIFSIGNALED(status) ) {
sprintf_cat( buf, "died due to %s",
@@ -687,12 +687,12 @@ GahpServer::Startup()
//
if ( get_port_range( FALSE, &low_port, &high_port ) == TRUE ) {
std::string buff;
- sprintf( buff, "%d,%d", low_port, high_port );
+ formatstr( buff, "%d,%d", low_port, high_port );
newenv.SetEnv( "GLOBUS_TCP_PORT_RANGE", buff.c_str() );
}
if ( get_port_range( TRUE, &low_port, &high_port ) == TRUE ) {
std::string buff;
- sprintf( buff, "%d,%d", low_port, high_port );
+ formatstr( buff, "%d,%d", low_port, high_port );
newenv.SetEnv( "GLOBUS_TCP_SOURCE_RANGE", buff.c_str() );
}
@@ -940,7 +940,7 @@ GahpServer::command_cache_proxy_from_file( GahpProxyInfo *new_proxy )
}
std::string buf;
- int x = sprintf(buf,"%s %d %s",command,new_proxy->proxy->id,
+ int x = formatstr(buf,"%s %d %s",command,new_proxy->proxy->id,
escapeGahpString(new_proxy->proxy->proxy_filename));
ASSERT( x > 0 );
write_line(buf.c_str());
@@ -972,7 +972,7 @@ GahpServer::uncacheProxy( GahpProxyInfo *gahp_proxy )
}
std::string buf;
- int x = sprintf(buf,"%s %d",command,gahp_proxy->proxy->id);
+ int x = formatstr(buf,"%s %d",command,gahp_proxy->proxy->id);
ASSERT( x > 0 );
write_line(buf.c_str());
@@ -1047,7 +1047,7 @@ GahpServer::command_use_cached_proxy( GahpProxyInfo *new_proxy )
}
std::string buf;
- int x = sprintf(buf,"%s %d",command,new_proxy->proxy->id);
+ int x = formatstr(buf,"%s %d",command,new_proxy->proxy->id);
ASSERT( x > 0 );
write_line(buf.c_str());
@@ -1411,7 +1411,7 @@ GahpServer::command_initialize_from_file(const char *proxy_path,
if ( command == NULL ) {
command = "INITIALIZE_FROM_FILE";
}
- int x = sprintf(buf,"%s %s",command,
+ int x = formatstr(buf,"%s %s",command,
escapeGahpString(proxy_path));
ASSERT( x > 0 );
write_line(buf.c_str());
@@ -1443,7 +1443,7 @@ GahpServer::command_response_prefix(const char *prefix)
}
std::string buf;
- int x = sprintf(buf,"%s %s",command,escapeGahpString(prefix));
+ int x = formatstr(buf,"%s %s",command,escapeGahpString(prefix));
ASSERT( x > 0 );
write_line(buf.c_str());
@@ -1586,7 +1586,7 @@ GahpClient::globus_gass_server_superez_init( char **gass_url, int port )
// Generate request line
std::string reqline;
- int x = sprintf(reqline,"%d",port);
+ int x = formatstr(reqline,"%d",port);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -1622,7 +1622,7 @@ GahpClient::globus_gass_server_superez_init( char **gass_url, int port )
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -1655,7 +1655,7 @@ GahpClient::globus_gram_client_job_request(
char *esc1 = strdup( escapeGahpString(resource_manager_contact) );
char *esc2 = strdup( escapeGahpString(callback_contact) );
char *esc3 = strdup( escapeGahpString(description) );
- int x = sprintf(reqline,"%s %s %d %s", esc1, esc2, limited_deleg, esc3 );
+ int x = formatstr(reqline,"%s %s %d %s", esc1, esc2, limited_deleg, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
@@ -1700,7 +1700,7 @@ GahpClient::globus_gram_client_job_request(
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -1722,7 +1722,7 @@ GahpClient::globus_gram_client_job_cancel(const char * job_contact)
// Generate request line
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(job_contact));
+ int x = formatstr(reqline,"%s",escapeGahpString(job_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -1754,7 +1754,7 @@ GahpClient::globus_gram_client_job_cancel(const char * job_contact)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -1777,7 +1777,7 @@ GahpClient::globus_gram_client_job_status(const char * job_contact,
// Generate request line
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(job_contact));
+ int x = formatstr(reqline,"%s",escapeGahpString(job_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -1814,7 +1814,7 @@ GahpClient::globus_gram_client_job_status(const char * job_contact,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -1843,7 +1843,7 @@ GahpClient::globus_gram_client_job_signal(const char * job_contact,
std::string reqline;
char *esc1 = strdup( escapeGahpString(job_contact) );
char *esc2 = strdup( escapeGahpString(signal_arg) );
- int x = sprintf(reqline,"%s %d %s",esc1,signal,esc2);
+ int x = formatstr(reqline,"%s %d %s",esc1,signal,esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -1887,7 +1887,7 @@ GahpClient::globus_gram_client_job_signal(const char * job_contact,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -1916,7 +1916,7 @@ GahpClient::globus_gram_client_job_callback_register(const char * job_contact,
std::string reqline;
char *esc1 = strdup( escapeGahpString(job_contact) );
char *esc2 = strdup( escapeGahpString(callback_contact) );
- int x = sprintf(reqline,"%s %s",esc1,esc2);
+ int x = formatstr(reqline,"%s %s",esc1,esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -1954,7 +1954,7 @@ GahpClient::globus_gram_client_job_callback_register(const char * job_contact,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -1976,7 +1976,7 @@ GahpClient::globus_gram_client_ping(const char * resource_contact)
// Generate request line
if (!resource_contact) resource_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(resource_contact));
+ int x = formatstr(reqline,"%s",escapeGahpString(resource_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -2008,7 +2008,7 @@ GahpClient::globus_gram_client_ping(const char * resource_contact)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -2030,7 +2030,7 @@ GahpClient::globus_gram_client_job_refresh_credentials(const char *job_contact,
// Generate request line
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s %d",escapeGahpString(job_contact),limited_deleg);
+ int x = formatstr(reqline,"%s %d",escapeGahpString(job_contact),limited_deleg);
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -2062,7 +2062,7 @@ GahpClient::globus_gram_client_job_refresh_credentials(const char *job_contact,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -2083,7 +2083,7 @@ GahpClient::globus_gram_client_get_jobmanager_version(const char * resource_cont
// Generate request line
if (!resource_contact) resource_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(resource_contact));
+ int x = formatstr(reqline,"%s",escapeGahpString(resource_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -2115,7 +2115,7 @@ GahpClient::globus_gram_client_get_jobmanager_version(const char * resource_cont
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -2603,7 +2603,7 @@ GahpClient::condor_job_submit(const char *schedd_name, ClassAd *job_ad,
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(ad_string.Value()) );
- int x = sprintf(reqline, "%s %s", esc1, esc2 );
+ int x = formatstr(reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -2648,7 +2648,7 @@ GahpClient::condor_job_submit(const char *schedd_name, ClassAd *job_ad,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -2694,7 +2694,7 @@ GahpClient::condor_job_update_constrained(const char *schedd_name,
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(constraint) );
char *esc3 = strdup( escapeGahpString(ad_string.Value()) );
- int x = sprintf( reqline, "%s %s %s", esc1, esc2, esc3 );
+ int x = formatstr( reqline, "%s %s %s", esc1, esc2, esc3 );
free( esc1 );
free( esc2 );
free( esc3 );
@@ -2737,7 +2737,7 @@ GahpClient::condor_job_update_constrained(const char *schedd_name,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -2763,7 +2763,7 @@ GahpClient::condor_job_status_constrained(const char *schedd_name,
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(constraint) );
- int x = sprintf( reqline, "%s %s", esc1, esc2 );
+ int x = formatstr( reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -2830,7 +2830,7 @@ GahpClient::condor_job_status_constrained(const char *schedd_name,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -2855,7 +2855,7 @@ GahpClient::condor_job_remove(const char *schedd_name, PROC_ID job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(reason) );
- int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
+ int x = formatstr(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
@@ -2898,7 +2898,7 @@ GahpClient::condor_job_remove(const char *schedd_name, PROC_ID job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -2941,7 +2941,7 @@ GahpClient::condor_job_update(const char *schedd_name, PROC_ID job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(ad_string.Value()) );
- int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
+ int x = formatstr(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free( esc1 );
free( esc2 );
@@ -2984,7 +2984,7 @@ GahpClient::condor_job_update(const char *schedd_name, PROC_ID job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3009,7 +3009,7 @@ GahpClient::condor_job_hold(const char *schedd_name, PROC_ID job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(reason) );
- int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
+ int x = formatstr(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
@@ -3052,7 +3052,7 @@ GahpClient::condor_job_hold(const char *schedd_name, PROC_ID job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3077,7 +3077,7 @@ GahpClient::condor_job_release(const char *schedd_name, PROC_ID job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(reason) );
- int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
+ int x = formatstr(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
@@ -3120,7 +3120,7 @@ GahpClient::condor_job_release(const char *schedd_name, PROC_ID job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3162,7 +3162,7 @@ GahpClient::condor_job_stage_in(const char *schedd_name, ClassAd *job_ad)
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(ad_string.Value()) );
- int x = sprintf(reqline, "%s %s", esc1, esc2);
+ int x = formatstr(reqline, "%s %s", esc1, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -3204,7 +3204,7 @@ GahpClient::condor_job_stage_in(const char *schedd_name, ClassAd *job_ad)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3226,7 +3226,7 @@ GahpClient::condor_job_stage_out(const char *schedd_name, PROC_ID job_id)
if (!schedd_name) schedd_name=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
- int x = sprintf(reqline, "%s %d.%d", esc1, job_id.cluster, job_id.proc);
+ int x = formatstr(reqline, "%s %d.%d", esc1, job_id.cluster, job_id.proc);
free( esc1 );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -3267,7 +3267,7 @@ GahpClient::condor_job_stage_out(const char *schedd_name, PROC_ID job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3292,7 +3292,7 @@ GahpClient::condor_job_refresh_proxy(const char *schedd_name, PROC_ID job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
char *esc2 = strdup( escapeGahpString(proxy_file) );
- int x = sprintf(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
+ int x = formatstr(reqline, "%s %d.%d %s", esc1, job_id.cluster, job_id.proc,
esc2);
free(esc1);
free(esc2);
@@ -3335,7 +3335,7 @@ GahpClient::condor_job_refresh_proxy(const char *schedd_name, PROC_ID job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3362,7 +3362,7 @@ GahpClient::condor_job_update_lease(const char *schedd_name,
if (!schedd_name) schedd_name=NULLSTRING;
std::string reqline;
char *esc1 = strdup( escapeGahpString(schedd_name) );
- int x = sprintf(reqline, "%s %d", esc1, jobs.Length());
+ int x = formatstr(reqline, "%s %d", esc1, jobs.Length());
free( esc1 );
ASSERT( x > 0 );
// Add variable arguments
@@ -3431,7 +3431,7 @@ GahpClient::condor_job_update_lease(const char *schedd_name,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3462,7 +3462,7 @@ GahpClient::blah_job_submit(ClassAd *job_ad, char **job_id)
unparser.Unparse( job_ad, ad_string );
}
std::string reqline;
- int x = sprintf( reqline, "%s", escapeGahpString(ad_string.Value()) );
+ int x = formatstr( reqline, "%s", escapeGahpString(ad_string.Value()) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -3502,7 +3502,7 @@ GahpClient::blah_job_submit(ClassAd *job_ad, char **job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3523,7 +3523,7 @@ GahpClient::blah_job_status(const char *job_id, ClassAd **status_ad)
// Generate request line
if (!job_id) job_id=NULLSTRING;
std::string reqline;
- int x = sprintf( reqline, "%s", escapeGahpString(job_id) );
+ int x = formatstr( reqline, "%s", escapeGahpString(job_id) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -3567,7 +3567,7 @@ GahpClient::blah_job_status(const char *job_id, ClassAd **status_ad)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3588,7 +3588,7 @@ GahpClient::blah_job_cancel(const char *job_id)
// Generate request line
if (!job_id) job_id=NULLSTRING;
std::string reqline;
- int x = sprintf( reqline, "%s", escapeGahpString( job_id ) );
+ int x = formatstr( reqline, "%s", escapeGahpString( job_id ) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -3625,7 +3625,7 @@ GahpClient::blah_job_cancel(const char *job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3648,7 +3648,7 @@ GahpClient::blah_job_refresh_proxy(const char *job_id, const char *proxy_file)
std::string reqline;
char *esc1 = strdup( escapeGahpString(job_id) );
char *esc2 = strdup( escapeGahpString(proxy_file) );
- int x = sprintf( reqline, "%s %s", esc1, esc2 );
+ int x = formatstr( reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -3687,7 +3687,7 @@ GahpClient::blah_job_refresh_proxy(const char *job_id, const char *proxy_file)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3712,7 +3712,7 @@ GahpClient::nordugrid_submit(const char *hostname, const char *rsl,
std::string reqline;
char *esc1 = strdup( escapeGahpString(hostname) );
char *esc2 = strdup( escapeGahpString(rsl) );
- int x = sprintf(reqline, "%s %s", esc1, esc2 );
+ int x = formatstr(reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -3754,7 +3754,7 @@ GahpClient::nordugrid_submit(const char *hostname, const char *rsl,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3779,7 +3779,7 @@ GahpClient::nordugrid_status(const char *hostname, const char *job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(hostname) );
char *esc2 = strdup( escapeGahpString(job_id) );
- int x = sprintf(reqline,"%s %s", esc1, esc2 );
+ int x = formatstr(reqline,"%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -3821,7 +3821,7 @@ GahpClient::nordugrid_status(const char *hostname, const char *job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3851,7 +3851,7 @@ GahpClient::nordugrid_ldap_query(const char *hostname, const char *ldap_base,
char *esc2 = strdup( escapeGahpString(ldap_base) );
char *esc3 = strdup( escapeGahpString(ldap_filter) );
char *esc4 = strdup( escapeGahpString(ldap_attrs) );
- int x = sprintf(reqline,"%s %s %s %s", esc1, esc2, esc3, esc4 );
+ int x = formatstr(reqline,"%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
free( esc3 );
@@ -3895,7 +3895,7 @@ GahpClient::nordugrid_ldap_query(const char *hostname, const char *ldap_base,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3919,7 +3919,7 @@ GahpClient::nordugrid_cancel(const char *hostname, const char *job_id)
std::string reqline;
char *esc1 = strdup( escapeGahpString(hostname) );
char *esc2 = strdup( escapeGahpString(job_id) );
- int x = sprintf(reqline,"%s %s", esc1, esc2 );
+ int x = formatstr(reqline,"%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -3958,7 +3958,7 @@ GahpClient::nordugrid_cancel(const char *hostname, const char *job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -3983,7 +3983,7 @@ GahpClient::nordugrid_stage_in(const char *hostname, const char *job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(hostname) );
char *esc2 = strdup( escapeGahpString(job_id) );
- int x = sprintf(reqline,"%s %s %d", esc1, esc2, files.number() );
+ int x = formatstr(reqline,"%s %s %d", esc1, esc2, files.number() );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -4030,7 +4030,7 @@ GahpClient::nordugrid_stage_in(const char *hostname, const char *job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4055,7 +4055,7 @@ GahpClient::nordugrid_stage_out(const char *hostname, const char *job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(hostname) );
char *esc2 = strdup( escapeGahpString(job_id) );
- int x = sprintf(reqline,"%s %s %d", esc1, esc2, files.number() );
+ int x = formatstr(reqline,"%s %s %d", esc1, esc2, files.number() );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -4102,7 +4102,7 @@ GahpClient::nordugrid_stage_out(const char *hostname, const char *job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4127,7 +4127,7 @@ GahpClient::nordugrid_stage_out2(const char *hostname, const char *job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(hostname) );
char *esc2 = strdup( escapeGahpString(job_id) );
- int x = sprintf(reqline,"%s %s %d", esc1, esc2, src_files.number() );
+ int x = formatstr(reqline,"%s %s %d", esc1, esc2, src_files.number() );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -4182,7 +4182,7 @@ GahpClient::nordugrid_stage_out2(const char *hostname, const char *job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4209,7 +4209,7 @@ GahpClient::nordugrid_exit_info(const char *hostname, const char *job_id,
std::string reqline;
char *esc1 = strdup( escapeGahpString(hostname) );
char *esc2 = strdup( escapeGahpString(job_id) );
- int x = sprintf(reqline, "%s %s", esc1, esc2 );
+ int x = formatstr(reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -4257,7 +4257,7 @@ GahpClient::nordugrid_exit_info(const char *hostname, const char *job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4278,7 +4278,7 @@ GahpClient::nordugrid_ping(const char *hostname)
// Generate request line
if (!hostname) hostname=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(hostname));
+ int x = formatstr(reqline,"%s",escapeGahpString(hostname));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -4315,7 +4315,7 @@ GahpClient::nordugrid_ping(const char *hostname)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4339,7 +4339,7 @@ GahpClient::gridftp_transfer(const char *src_url, const char *dst_url)
std::string reqline;
char *esc1 = strdup( escapeGahpString(src_url) );
char *esc2 = strdup( escapeGahpString(dst_url) );
- int x = sprintf( reqline, "%s %s", esc1, esc2 );
+ int x = formatstr( reqline, "%s %s", esc1, esc2 );
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -4378,7 +4378,7 @@ GahpClient::gridftp_transfer(const char *src_url, const char *dst_url)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4408,7 +4408,7 @@ desc[i-1] = '\0';
}
description = desc;
std::string reqline;
- int x = sprintf( reqline, "%s", escapeGahpString(description) );
+ int x = formatstr( reqline, "%s", escapeGahpString(description) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
free(desc);
@@ -4467,7 +4467,7 @@ GahpClient::unicore_job_start(const char * job_contact)
// Generate request line
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(job_contact));
+ int x = formatstr(reqline,"%s",escapeGahpString(job_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -4522,7 +4522,7 @@ GahpClient::unicore_job_destroy(const char * job_contact)
// Generate request line
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(job_contact));
+ int x = formatstr(reqline,"%s",escapeGahpString(job_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -4579,7 +4579,7 @@ GahpClient::unicore_job_status(const char * job_contact,
// Generate request line
if (!job_contact) job_contact=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(job_contact));
+ int x = formatstr(reqline,"%s",escapeGahpString(job_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -4645,7 +4645,7 @@ desc[i-1] = '\0';
}
description = desc;
std::string reqline;
- int x = sprintf( reqline, "%s", escapeGahpString(description) );
+ int x = formatstr( reqline, "%s", escapeGahpString(description) );
ASSERT( x > 0 );
const char *buf = reqline.c_str();
free(desc);
@@ -4750,7 +4750,7 @@ GahpClient::cream_delegate(const char *delg_service, const char *delg_id)
std::string reqline;
char *esc1 = strdup( escapeGahpString(delg_service) );
char *esc2 = strdup( escapeGahpString(delg_id) );
- int x = sprintf(reqline, "%s %s", esc2, esc1);
+ int x = formatstr(reqline, "%s %s", esc2, esc1);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -4792,7 +4792,7 @@ GahpClient::cream_delegate(const char *delg_service, const char *delg_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4822,7 +4822,7 @@ GahpClient::cream_job_register(const char *service, const char *delg_id,
char *esc2 = strdup( escapeGahpString(delg_id) );
char *esc3 = strdup( escapeGahpString(jdl) );
char *esc4 = strdup( escapeGahpString(lease_id) );
- int x = sprintf( reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
+ int x = formatstr( reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
free( esc3 );
@@ -4881,7 +4881,7 @@ GahpClient::cream_job_register(const char *service, const char *delg_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4906,7 +4906,7 @@ GahpClient::cream_job_start(const char *service, const char *job_id)
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
// Just start one job
- int x = sprintf(reqline, "%s 1 %s", esc1, esc2);
+ int x = formatstr(reqline, "%s 1 %s", esc1, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -4947,7 +4947,7 @@ GahpClient::cream_job_start(const char *service, const char *job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -4972,7 +4972,7 @@ GahpClient::cream_job_purge(const char *service, const char *job_id)
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
- int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
+ int x = formatstr(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -5013,7 +5013,7 @@ GahpClient::cream_job_purge(const char *service, const char *job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5038,7 +5038,7 @@ GahpClient::cream_job_cancel(const char *service, const char *job_id)
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
- int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
+ int x = formatstr(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -5079,7 +5079,7 @@ GahpClient::cream_job_cancel(const char *service, const char *job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5104,7 +5104,7 @@ GahpClient::cream_job_suspend(const char *service, const char *job_id)
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
- int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
+ int x = formatstr(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -5145,7 +5145,7 @@ GahpClient::cream_job_suspend(const char *service, const char *job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5170,7 +5170,7 @@ GahpClient::cream_job_resume(const char *service, const char *job_id)
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
- int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
+ int x = formatstr(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -5211,7 +5211,7 @@ GahpClient::cream_job_resume(const char *service, const char *job_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5237,7 +5237,7 @@ GahpClient::cream_job_status(const char *service, const char *job_id,
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(job_id) );
int job_number = 1; // Just query 1 job for now
- int x = sprintf(reqline, "%s %d %s", esc1, job_number, esc2);
+ int x = formatstr(reqline, "%s %d %s", esc1, job_number, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -5293,7 +5293,7 @@ GahpClient::cream_job_status(const char *service, const char *job_id,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5316,7 +5316,7 @@ GahpClient::cream_job_status_all(const char *service,
char *esc1 = strdup( escapeGahpString(service) );
int job_number = 0; // "all"
- int x = sprintf(reqline, "%s %d", esc1, job_number);
+ int x = formatstr(reqline, "%s %d", esc1, job_number);
ASSERT( x > 0 );
free( esc1 );
const char *buf = reqline.c_str();
@@ -5381,7 +5381,7 @@ GahpClient::cream_job_status_all(const char *service,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5405,7 +5405,7 @@ GahpClient::cream_proxy_renew(const char *delg_service, const char *delg_id)
std::string reqline;
char *esc1 = strdup( escapeGahpString(delg_service) );
char *esc2 = strdup( escapeGahpString(delg_id) );
- int x = sprintf(reqline, "%s %s", esc1, esc2);
+ int x = formatstr(reqline, "%s %s", esc1, esc2);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -5446,7 +5446,7 @@ GahpClient::cream_proxy_renew(const char *delg_service, const char *delg_id)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5467,7 +5467,7 @@ GahpClient::cream_ping(const char * service)
// Generate request line
if (!service) service=NULLSTRING;
std::string reqline;
- int x = sprintf(reqline,"%s",escapeGahpString(service));
+ int x = formatstr(reqline,"%s",escapeGahpString(service));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
@@ -5512,7 +5512,7 @@ GahpClient::cream_ping(const char * service)
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5535,7 +5535,7 @@ GahpClient::cream_set_lease(const char *service, const char *lease_id, time_t &l
std::string reqline;
char *esc1 = strdup( escapeGahpString(service) );
char *esc2 = strdup( escapeGahpString(lease_id) );
- int x = sprintf(reqline, "%s %s %ld", esc1, esc2, (long)lease_expiry);
+ int x = formatstr(reqline, "%s %s %ld", esc1, esc2, (long)lease_expiry);
free( esc1 );
free( esc2 );
ASSERT( x > 0 );
@@ -5585,7 +5585,7 @@ GahpClient::cream_set_lease(const char *service, const char *lease_id, time_t &l
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5662,7 +5662,7 @@ int GahpClient::ec2_vm_start( std::string service_url,
char* esc11 = strdup( escapeGahpString(vpc_ip) );
char* esc12 = strdup( escapeGahpString(client_token) );
- int x = sprintf(reqline, "%s %s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11, esc12 );
+ int x = formatstr(reqline, "%s %s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11, esc12 );
free( esc1 );
free( esc2 );
@@ -5744,7 +5744,7 @@ int GahpClient::ec2_vm_start( std::string service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5785,7 +5785,7 @@ int GahpClient::ec2_vm_stop( std::string service_url,
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(instance_id) );
- int x = sprintf(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
+ int x = formatstr(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
@@ -5837,7 +5837,7 @@ int GahpClient::ec2_vm_stop( std::string service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -5879,7 +5879,7 @@ int GahpClient::ec2_vm_status( std::string service_url,
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(instance_id) );
- int x = sprintf(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
+ int x = formatstr(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4 );
free( esc1 );
free( esc2 );
@@ -5976,7 +5976,7 @@ int GahpClient::ec2_vm_status( std::string service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -6000,7 +6000,7 @@ int GahpClient::ec2_ping(std::string service_url,
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
std::string reqline;
- sprintf(reqline, "%s %s %s", esc1, esc2, esc3 );
+ formatstr(reqline, "%s %s %s", esc1, esc2, esc3 );
const char *buf = reqline.c_str();
free( esc1 );
@@ -6030,7 +6030,7 @@ int GahpClient::ec2_ping(std::string service_url,
// Now check if pending command timed out.
if ( check_pending_timeout(command,buf) ) {
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -6074,7 +6074,7 @@ int GahpClient::ec2_vm_create_keypair( std::string service_url,
char* esc4 = strdup( escapeGahpString(keyname) );
char* esc5 = strdup( escapeGahpString(outputfile) );
- int x = sprintf(reqline, "%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5);
+ int x = formatstr(reqline, "%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5);
free( esc1 );
free( esc2 );
@@ -6130,7 +6130,7 @@ int GahpClient::ec2_vm_create_keypair( std::string service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -6174,7 +6174,7 @@ int GahpClient::ec2_vm_destroy_keypair( std::string service_url,
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
char* esc4 = strdup( escapeGahpString(keyname) );
- int x = sprintf(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4);
+ int x = formatstr(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4);
free( esc1 );
free( esc2 );
@@ -6229,7 +6229,7 @@ int GahpClient::ec2_vm_destroy_keypair( std::string service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -6268,7 +6268,7 @@ int GahpClient::ec2_vm_vm_keypair_all( std::string service_url,
char* esc2 = strdup( escapeGahpString(publickeyfile) );
char* esc3 = strdup( escapeGahpString(privatekeyfile) );
- int x = sprintf(reqline, "%s %s %s", esc1, esc2, esc3 );
+ int x = formatstr(reqline, "%s %s %s", esc1, esc2, esc3 );
free( esc1 );
free( esc2 );
@@ -6334,7 +6334,7 @@ int GahpClient::ec2_vm_vm_keypair_all( std::string service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -6379,7 +6379,7 @@ int GahpClient::ec2_associate_address(std::string service_url,
char* esc4 = strdup( escapeGahpString(instance_id) );
char* esc5 = strdup( escapeGahpString(elastic_ip) );
- int x = sprintf(reqline, "%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5 );
+ int x = formatstr(reqline, "%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5 );
free( esc1 );
free( esc2 );
@@ -6475,7 +6475,7 @@ GahpClient::ec2_create_tags(std::string service_url,
char *esc3 = strdup(escapeGahpString(privatekeyfile));
char *esc4 = strdup(escapeGahpString(instance_id));
- int x = sprintf(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4);
+ int x = formatstr(reqline, "%s %s %s %s", esc1, esc2, esc3, esc4);
free(esc1);
free(esc2);
@@ -6579,7 +6579,7 @@ int GahpClient::ec2_attach_volume(std::string service_url,
char* esc5 = strdup( escapeGahpString(instance_id) );
char* esc6 = strdup( escapeGahpString(device_id) );
- int x = sprintf(reqline, "%s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6 );
+ int x = formatstr(reqline, "%s %s %s %s %s %s", esc1, esc2, esc3, esc4, esc5, esc6 );
free( esc1 );
free( esc2 );
@@ -6757,7 +6757,7 @@ int GahpClient::dcloud_submit( const char *service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -6854,7 +6854,7 @@ int GahpClient::dcloud_status_all( const char *service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -6940,7 +6940,7 @@ int GahpClient::dcloud_action( const char *service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -7032,7 +7032,7 @@ int GahpClient::dcloud_info( const char *service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -7125,7 +7125,7 @@ int GahpClient::dcloud_find( const char *service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -7211,7 +7211,7 @@ int GahpClient::dcloud_get_max_name_length( const char *service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
@@ -7302,7 +7302,7 @@ int GahpClient::dcloud_start_auto( const char *service_url,
if ( check_pending_timeout(command, buf) )
{
// pending command timed out.
- sprintf( error_string, "%s timed out", command );
+ formatstr( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
diff --git a/src/condor_gridmanager/globusjob.cpp b/src/condor_gridmanager/globusjob.cpp
index cc01f0a..8d5c73a 100644
--- a/src/condor_gridmanager/globusjob.cpp
+++ b/src/condor_gridmanager/globusjob.cpp
@@ -378,7 +378,7 @@ static bool write_classad_input_file( ClassAd *classad,
return false;
}
- sprintf(out_filename, "_condor_private_classad_in_%d.%d",
+ formatstr(out_filename, "_condor_private_classad_in_%d.%d",
procID.cluster, procID.proc);
std::string out_filename_full;
@@ -700,7 +700,7 @@ GlobusJob::GlobusJob( ClassAd *classad )
(TimerHandlercpp)&GlobusJob::ProxyCallback, this );
if ( jobProxy == NULL ) {
if ( error_string == "" ) {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_X509_USER_PROXY );
}
goto error_exit;
@@ -724,7 +724,7 @@ GlobusJob::GlobusJob( ClassAd *classad )
}
free(args);
}
- sprintf( grid_proxy_subject, "GT2/%s",
+ formatstr( grid_proxy_subject, "GT2/%s",
jobProxy->subject->fqan );
gahp = new GahpClient( grid_proxy_subject.c_str(), gahp_path, &gahp_args );
gahp->setNotificationTimerId( evaluateStateTid );
@@ -739,7 +739,7 @@ GlobusJob::GlobusJob( ClassAd *classad )
token = GetNextToken( " ", false );
if ( !token || ( strcasecmp( token, "gt2" ) && strcasecmp( token, "gt5" ) ) ) {
- sprintf( error_string, "%s not of type gt2 or gt5",
+ formatstr( error_string, "%s not of type gt2 or gt5",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -751,13 +751,13 @@ GlobusJob::GlobusJob( ClassAd *classad )
if ( token && *token ) {
resourceManagerString = strdup( token );
} else {
- sprintf( error_string, "%s missing GRAM service name",
+ formatstr( error_string, "%s missing GRAM service name",
ATTR_GRID_RESOURCE );
goto error_exit;
}
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -770,7 +770,7 @@ GlobusJob::GlobusJob( ClassAd *classad )
token = GetNextToken( " ", false );
if ( !token || ( strcasecmp( token, "gt2" ) && strcasecmp( token, "gt5" ) ) ) {
- sprintf( error_string, "%s not of type gt2 or gt5",
+ formatstr( error_string, "%s not of type gt2 or gt5",
ATTR_GRID_JOB_ID );
goto error_exit;
}
@@ -781,7 +781,7 @@ GlobusJob::GlobusJob( ClassAd *classad )
token = GetNextToken( " ", false );
token = GetNextToken( " ", false );
if ( !token ) {
- sprintf( error_string, "%s missing job ID",
+ formatstr( error_string, "%s missing job ID",
ATTR_GRID_JOB_ID );
goto error_exit;
}
@@ -1284,7 +1284,7 @@ void GlobusJob::doEvaluateState()
if ( rc == GLOBUS_SUCCESS ) {
// Previously this supported GRAM 1.0
dprintf(D_ALWAYS, "(%d.%d) Unexpected remote response. GRAM 1.6 is now required.\n", procID.cluster, procID.proc);
- sprintf(errorString,"Unexpected remote response. Remote server must speak GRAM 1.6");
+ formatstr(errorString,"Unexpected remote response. Remote server must speak GRAM 1.6");
myResource->JMComplete( this );
gmState = GM_HOLD;
} else if ( rc == GLOBUS_GRAM_PROTOCOL_ERROR_WAITING_FOR_COMMIT ) {
@@ -2864,7 +2864,7 @@ void GlobusJob::SetRemoteJobId( const char *job_id, bool is_gt5 )
}
std::string full_job_id;
if ( job_id ) {
- sprintf( full_job_id, "%s %s %s", is_gt5 ? "gt5" : "gt2",
+ formatstr( full_job_id, "%s %s %s", is_gt5 ? "gt5" : "gt2",
resourceManagerString, job_id );
}
BaseJob::SetRemoteJobId( full_job_id.c_str() );
@@ -2913,7 +2913,7 @@ std::string *GlobusJob::buildSubmitRSL()
}
//Start off the RSL
- sprintf( *rsl, "&(rsl_substitution=(GRIDMANAGER_GASS_URL %s))",
+ formatstr( *rsl, "&(rsl_substitution=(GRIDMANAGER_GASS_URL %s))",
gassServerUrl );
//We're assuming all job clasads have a command attribute
@@ -2951,7 +2951,7 @@ std::string *GlobusJob::buildSubmitRSL()
std::string input_classad_filename;
std::string output_classad_filename;
std::string gridshell_log_filename;
- sprintf( gridshell_log_filename, "condor_gridshell.log.%d.%d",
+ formatstr( gridshell_log_filename, "condor_gridshell.log.%d.%d",
procID.cluster, procID.proc );
if( useGridShell ) {
@@ -2989,7 +2989,7 @@ std::string *GlobusJob::buildSubmitRSL()
procID.cluster, procID.proc, input_classad_filename.c_str() );
}
- sprintf(output_classad_filename, "%s.OUT", input_classad_filename.c_str());
+ formatstr(output_classad_filename, "%s.OUT", input_classad_filename.c_str());
outputClassadFilename = output_classad_filename;
@@ -3042,7 +3042,7 @@ std::string *GlobusJob::buildSubmitRSL()
if(!args.AppendArgsFromClassAd(jobAd,&arg_errors)) {
dprintf(D_ALWAYS,"(%d.%d) Failed to read job arguments: %s\n",
procID.cluster, procID.proc, arg_errors.Value());
- sprintf(errorString, "Failed to read job arguments: %s\n",
+ formatstr(errorString, "Failed to read job arguments: %s\n",
arg_errors.Value());
delete rsl;
return NULL;
@@ -3079,7 +3079,7 @@ std::string *GlobusJob::buildSubmitRSL()
if ( streamOutput ) {
*rsl += ")(stdout=";
- sprintf( buff, "$(GRIDMANAGER_GASS_URL)%s", localOutput );
+ formatstr( buff, "$(GRIDMANAGER_GASS_URL)%s", localOutput );
*rsl += rsl_stringify( buff );
} else {
if ( stageOutput ) {
@@ -3099,7 +3099,7 @@ std::string *GlobusJob::buildSubmitRSL()
if ( streamError ) {
*rsl += ")(stderr=";
- sprintf( buff, "$(GRIDMANAGER_GASS_URL)%s", localError );
+ formatstr( buff, "$(GRIDMANAGER_GASS_URL)%s", localError );
*rsl += rsl_stringify( buff );
} else {
if ( stageError ) {
@@ -3177,14 +3177,14 @@ std::string *GlobusJob::buildSubmitRSL()
if ( stageOutput ) {
*rsl += "($(GLOBUS_CACHED_STDOUT) ";
- sprintf( buff, "$(GRIDMANAGER_GASS_URL)%s", localOutput );
+ formatstr( buff, "$(GRIDMANAGER_GASS_URL)%s", localOutput );
*rsl += rsl_stringify( buff );
*rsl += ')';
}
if ( stageError ) {
*rsl += "($(GLOBUS_CACHED_STDERR) ";
- sprintf( buff, "$(GRIDMANAGER_GASS_URL)%s", localError );
+ formatstr( buff, "$(GRIDMANAGER_GASS_URL)%s", localError );
*rsl += rsl_stringify( buff );
*rsl += ')';
}
@@ -3240,7 +3240,7 @@ std::string *GlobusJob::buildSubmitRSL()
if(!envobj.MergeFrom(jobAd,&env_errors)) {
dprintf(D_ALWAYS,"(%d.%d) Failed to read job environment: %s\n",
procID.cluster, procID.proc, env_errors.Value());
- sprintf(errorString, "Failed to read job environment: %s\n",
+ formatstr(errorString, "Failed to read job environment: %s\n",
env_errors.Value());
delete rsl;
return NULL;
@@ -3257,14 +3257,14 @@ std::string *GlobusJob::buildSubmitRSL()
continue;
}
*equals = '\0';
- sprintf( buff, "(%s %s)", env_vec[i],
+ formatstr( buff, "(%s %s)", env_vec[i],
rsl_stringify(equals + 1) );
*rsl += buff;
}
deleteStringArray(env_vec);
}
- sprintf( buff, ")(proxy_timeout=%d", JM_MIN_PROXY_TIME );
+ formatstr( buff, ")(proxy_timeout=%d", JM_MIN_PROXY_TIME );
*rsl += buff;
int default_timeout = JM_COMMIT_TIMEOUT;
@@ -3273,7 +3273,7 @@ std::string *GlobusJob::buildSubmitRSL()
}
int commit_timeout = param_integer("GRIDMANAGER_GLOBUS_COMMIT_TIMEOUT", default_timeout);
- sprintf( buff, ")(save_state=yes)(two_phase=%d)"
+ formatstr( buff, ")(save_state=yes)(two_phase=%d)"
"(remote_io_url=$(GRIDMANAGER_GASS_URL))",
commit_timeout);
*rsl += buff;
@@ -3294,23 +3294,23 @@ std::string *GlobusJob::buildRestartRSL()
DeleteOutput();
- sprintf( *rsl, "&(rsl_substitution=(GRIDMANAGER_GASS_URL %s))(restart=%s)"
+ formatstr( *rsl, "&(rsl_substitution=(GRIDMANAGER_GASS_URL %s))(restart=%s)"
"(remote_io_url=$(GRIDMANAGER_GASS_URL))", gassServerUrl,
jobContact );
if ( streamOutput ) {
*rsl += "(stdout=";
- sprintf( buff, "$(GRIDMANAGER_GASS_URL)%s", localOutput );
+ formatstr( buff, "$(GRIDMANAGER_GASS_URL)%s", localOutput );
*rsl += rsl_stringify( buff );
*rsl += ")(stdout_position=0)";
}
if ( streamError ) {
*rsl += "(stderr=";
- sprintf( buff, "$(GRIDMANAGER_GASS_URL)%s", localError );
+ formatstr( buff, "$(GRIDMANAGER_GASS_URL)%s", localError );
*rsl += rsl_stringify( buff );
*rsl += ")(stderr_position=0)";
}
- sprintf( buff, "(proxy_timeout=%d)", JM_MIN_PROXY_TIME );
+ formatstr( buff, "(proxy_timeout=%d)", JM_MIN_PROXY_TIME );
*rsl += buff;
return rsl;
@@ -3324,16 +3324,16 @@ std::string *GlobusJob::buildStdioUpdateRSL()
DeleteOutput();
- sprintf( *rsl, "&(remote_io_url=%s)", gassServerUrl );
+ formatstr( *rsl, "&(remote_io_url=%s)", gassServerUrl );
if ( streamOutput ) {
*rsl += "(stdout=";
- sprintf( buff, "%s%s", gassServerUrl, localOutput );
+ formatstr( buff, "%s%s", gassServerUrl, localOutput );
*rsl += rsl_stringify( buff );
*rsl += ")(stdout_position=0)";
}
if ( streamError ) {
*rsl += "(stderr=";
- sprintf( buff, "%s%s", gassServerUrl, localError );
+ formatstr( buff, "%s%s", gassServerUrl, localError );
*rsl += rsl_stringify( buff );
*rsl += ")(stderr_position=0)";
}
diff --git a/src/condor_gridmanager/globusresource.cpp b/src/condor_gridmanager/globusresource.cpp
index 4018d0b..d9ef3c9 100644
--- a/src/condor_gridmanager/globusresource.cpp
+++ b/src/condor_gridmanager/globusresource.cpp
@@ -142,7 +142,7 @@ bool GlobusResource::Init()
}
std::string gahp_name;
- sprintf( gahp_name, "GT2/%s", proxyFQAN );
+ formatstr( gahp_name, "GT2/%s", proxyFQAN );
gahp = new GahpClient( gahp_name.c_str() );
@@ -219,7 +219,7 @@ const char *GlobusResource::CanonicalName( const char *name )
parse_resource_manager_string( name, &host, &port, NULL, NULL );
- sprintf( canonical, "%s:%s", host, *port ? port : "2119" );
+ formatstr( canonical, "%s:%s", host, *port ? port : "2119" );
free( host );
free( port );
@@ -232,7 +232,7 @@ const char *GlobusResource::HashName( const char *resource_name,
{
static std::string hash_name;
- sprintf( hash_name, "gt2 %s#%s", resource_name, proxy_subject );
+ formatstr( hash_name, "gt2 %s#%s", resource_name, proxy_subject );
return hash_name.c_str();
}
@@ -713,7 +713,7 @@ GlobusResource::CleanupMonitorJob()
if ( monitorDirectory ) {
std::string tmp_dir;
- sprintf( tmp_dir, "%s.remove", monitorDirectory );
+ formatstr( tmp_dir, "%s.remove", monitorDirectory );
MSC_SUPPRESS_WARNING_FIXME(6031) // warning: return value of 'rename' ignored.
rename( monitorDirectory, tmp_dir.c_str() );
@@ -754,7 +754,7 @@ GlobusResource::SubmitMonitorJob()
g_MonitorUID++;
std::string buff;
- sprintf( buff, "%s/grid-monitor.%s.%d", GridmanagerScratchDir,
+ formatstr( buff, "%s/grid-monitor.%s.%d", GridmanagerScratchDir,
resourceName, g_MonitorUID );
monitorDirectory = strdup( buff.c_str() );
@@ -767,10 +767,10 @@ GlobusResource::SubmitMonitorJob()
return false;
}
- sprintf( buff, "%s/grid-monitor-job-status", monitorDirectory );
+ formatstr( buff, "%s/grid-monitor-job-status", monitorDirectory );
monitorJobStatusFile = strdup( buff.c_str() );
- sprintf( buff, "%s/grid-monitor-log", monitorDirectory );
+ formatstr( buff, "%s/grid-monitor-log", monitorDirectory );
monitorLogFile = strdup( buff.c_str() );
@@ -809,13 +809,13 @@ GlobusResource::SubmitMonitorJob()
monitorGahp->setMode( GahpClient::normal );
const char *gassServerUrl = monitorGahp->getGlobusGassServerUrl();
- sprintf( RSL, "&(executable=%s%s)(stdout=%s%s)(arguments='--dest-url=%s%s')",
+ formatstr( RSL, "&(executable=%s%s)(stdout=%s%s)(arguments='--dest-url=%s%s')",
gassServerUrl, monitor_executable, gassServerUrl,
monitorLogFile, gassServerUrl, monitorJobStatusFile );
free( monitor_executable );
- sprintf( contact, "%s/jobmanager-fork", resourceName );
+ formatstr( contact, "%s/jobmanager-fork", resourceName );
std::string job_contact;
rc = monitorGahp->globus_gram_client_job_request( contact.c_str(),
diff --git a/src/condor_gridmanager/gridmanager.cpp b/src/condor_gridmanager/gridmanager.cpp
index 1f97ef7..a444f38 100644
--- a/src/condor_gridmanager/gridmanager.cpp
+++ b/src/condor_gridmanager/gridmanager.cpp
@@ -144,7 +144,7 @@ static int tSetAttributeString(int cluster, int proc,
const char * attr_name, const char * attr_value)
{
std::string tmp;
- sprintf(tmp, "\"%s\"", attr_value);
+ formatstr(tmp, "\"%s\"", attr_value);
return SetAttribute( cluster, proc, attr_name, tmp.c_str());
}
@@ -540,15 +540,15 @@ initJobExprs()
static bool done = false;
if(done) { return; }
- sprintf(expr_matched_or_undef, "(%s =!= %s)", ATTR_JOB_MATCHED, expr_false);
- sprintf(expr_managed, "(%s =?= \"%s\")", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
- sprintf(expr_not_managed, "(%s =!= \"%s\")", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
- sprintf(expr_not_held, "(%s != %d)", ATTR_JOB_STATUS, HELD);
- sprintf(expr_schedd_job_constraint, "(%s)", ScheddJobConstraint);
+ formatstr(expr_matched_or_undef, "(%s =!= %s)", ATTR_JOB_MATCHED, expr_false);
+ formatstr(expr_managed, "(%s =?= \"%s\")", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
+ formatstr(expr_not_managed, "(%s =!= \"%s\")", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
+ formatstr(expr_not_held, "(%s != %d)", ATTR_JOB_STATUS, HELD);
+ formatstr(expr_schedd_job_constraint, "(%s)", ScheddJobConstraint);
// The gridmanager never wants to see this job again.
// It should be in the process of leaving the queue.
- sprintf(expr_completely_done, "(%s =?= \"%s\")", ATTR_JOB_MANAGED, MANAGED_DONE);
- sprintf(expr_not_completely_done, "(%s =!= \"%s\")", ATTR_JOB_MANAGED, MANAGED_DONE);
+ formatstr(expr_completely_done, "(%s =?= \"%s\")", ATTR_JOB_MANAGED, MANAGED_DONE);
+ formatstr(expr_not_completely_done, "(%s =!= \"%s\")", ATTR_JOB_MANAGED, MANAGED_DONE);
done = true;
}
@@ -603,7 +603,7 @@ doContactSchedd()
pendingScheddVacates.startIterations();
while ( pendingScheddVacates.iterate( curr_request ) != 0 ) {
- sprintf( buff, "%d.%d", curr_request.job->procID.cluster,
+ formatstr( buff, "%d.%d", curr_request.job->procID.cluster,
curr_request.job->procID.proc );
job_ids.append( buff.c_str() );
}
@@ -617,13 +617,13 @@ doContactSchedd()
rval = ScheddObj->vacateJobs( &job_ids, VACATE_FAST, &errstack );
if ( rval == NULL ) {
- sprintf( error_str, "vacateJobs returned NULL, CondorError: %s!",
+ formatstr( error_str, "vacateJobs returned NULL, CondorError: %s!",
errstack.getFullText() );
goto contact_schedd_failure;
} else {
pendingScheddVacates.startIterations();
while ( pendingScheddVacates.iterate( curr_request ) != 0 ) {
- sprintf( buff, "job_%d_%d", curr_request.job->procID.cluster,
+ formatstr( buff, "job_%d_%d", curr_request.job->procID.cluster,
curr_request.job->procID.proc );
if ( !rval->LookupInteger( buff.c_str(), result ) ) {
dprintf( D_FULLDEBUG, "vacateJobs returned malformed ad\n" );
@@ -1125,19 +1125,19 @@ contact_schedd_next_add_job:
firstScheddContact = false;
addJobsSignaled = false;
} else {
- sprintf( error_str, "Schedd connection error during Add/RemoveJobs at line %d!", failure_line_num );
+ formatstr( error_str, "Schedd connection error during Add/RemoveJobs at line %d!", failure_line_num );
goto contact_schedd_failure;
}
if ( update_jobs_complete == true ) {
updateJobsSignaled = false;
} else {
- sprintf( error_str, "Schedd connection error during dirty attribute update at line %d!", failure_line_num );
+ formatstr( error_str, "Schedd connection error during dirty attribute update at line %d!", failure_line_num );
goto contact_schedd_failure;
}
if ( schedd_updates_complete == false ) {
- sprintf( error_str, "Schedd connection error during updates at line %d!", failure_line_num );
+ formatstr( error_str, "Schedd connection error during updates at line %d!", failure_line_num );
goto contact_schedd_failure;
}
diff --git a/src/condor_gridmanager/infnbatchjob.cpp b/src/condor_gridmanager/infnbatchjob.cpp
index b95a969..9ee5357 100644
--- a/src/condor_gridmanager/infnbatchjob.cpp
+++ b/src/condor_gridmanager/infnbatchjob.cpp
@@ -174,7 +174,7 @@ INFNBatchJob::INFNBatchJob( ClassAd *classad )
gahp_args.AppendArg( token );
}
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -192,16 +192,16 @@ INFNBatchJob::INFNBatchJob( ClassAd *classad )
if ( gahp_args.Count() > 0 ) {
gahp_path = param( "REMOTE_GAHP" );
if ( gahp_path == NULL ) {
- sprintf( error_string, "REMOTE_GAHP not defined" );
+ formatstr( error_string, "REMOTE_GAHP not defined" );
goto error_exit;
}
} else {
- sprintf( buff, "%s_GAHP", batchType );
+ formatstr( buff, "%s_GAHP", batchType );
gahp_path = param(buff.c_str());
if ( gahp_path == NULL ) {
gahp_path = param( "BATCH_GAHP" );
if ( gahp_path == NULL ) {
- sprintf( error_string, "Neither %s nor %s defined", buff.c_str(),
+ formatstr( error_string, "Neither %s nor %s defined", buff.c_str(),
"BATCH_GAHP" );
goto error_exit;
}
@@ -723,7 +723,7 @@ void INFNBatchJob::SetRemoteJobId( const char *job_id )
std::string full_job_id;
if ( job_id ) {
- sprintf( full_job_id, "%s %s", batchType, job_id );
+ formatstr( full_job_id, "%s %s", batchType, job_id );
}
BaseJob::SetRemoteJobId( full_job_id.c_str() );
}
diff --git a/src/condor_gridmanager/nordugridjob.cpp b/src/condor_gridmanager/nordugridjob.cpp
index f2858e5..4d9e856 100644
--- a/src/condor_gridmanager/nordugridjob.cpp
+++ b/src/condor_gridmanager/nordugridjob.cpp
@@ -198,7 +198,7 @@ NordugridJob::NordugridJob( ClassAd *classad )
(TimerHandlercpp)&BaseJob::SetEvaluateState, this );
if ( jobProxy == NULL ) {
if ( error_string == "" ) {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_X509_USER_PROXY );
}
goto error_exit;
@@ -228,7 +228,7 @@ NordugridJob::NordugridJob( ClassAd *classad )
token = GetNextToken( " ", false );
if ( !token || strcasecmp( token, "nordugrid" ) ) {
- sprintf( error_string, "%s not of type nordugrid",
+ formatstr( error_string, "%s not of type nordugrid",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -237,13 +237,13 @@ NordugridJob::NordugridJob( ClassAd *classad )
if ( token && *token ) {
resourceManagerString = strdup( token );
} else {
- sprintf( error_string, "%s missing server name",
+ formatstr( error_string, "%s missing server name",
ATTR_GRID_RESOURCE );
goto error_exit;
}
} else {
- sprintf( error_string, "%s is not set in the job ad",
+ formatstr( error_string, "%s is not set in the job ad",
ATTR_GRID_RESOURCE );
goto error_exit;
}
@@ -574,7 +574,7 @@ void NordugridJob::doEvaluateState()
case GM_EXIT_INFO: {
std::string filter;
StringList reply;
- sprintf( filter, "nordugrid-job-globalid=gsiftp://%s:2811/jobs/%s",
+ formatstr( filter, "nordugrid-job-globalid=gsiftp://%s:2811/jobs/%s",
resourceManagerString, remoteJobId );
rc = gahp->nordugrid_ldap_query( resourceManagerString, "mds-vo-name=local,o=grid", filter.c_str(), "nordugrid-job-usedcputime,nordugrid-job-usedwalltime,nordugrid-job-exitcode", reply );
@@ -895,7 +895,7 @@ void NordugridJob::SetRemoteJobId( const char *job_id )
std::string full_job_id;
if ( job_id ) {
- sprintf( full_job_id, "nordugrid %s %s", resourceManagerString,
+ formatstr( full_job_id, "nordugrid %s %s", resourceManagerString,
job_id );
}
BaseJob::SetRemoteJobId( full_job_id.c_str() );
@@ -926,7 +926,7 @@ std::string *NordugridJob::buildSubmitRSL()
//Start off the RSL
attr_value = param( "FULL_HOSTNAME" );
- sprintf( *rsl, "&(savestate=yes)(action=request)(hostname=%s)", attr_value );
+ formatstr( *rsl, "&(savestate=yes)(action=request)(hostname=%s)", attr_value );
free( attr_value );
attr_value = NULL;
@@ -950,7 +950,7 @@ std::string *NordugridJob::buildSubmitRSL()
if(!args.AppendArgsFromClassAd(jobAd,&arg_errors)) {
dprintf(D_ALWAYS,"(%d.%d) Failed to read job arguments: %s\n",
procID.cluster, procID.proc, arg_errors.Value());
- sprintf(errorString,"Failed to read job arguments: %s\n",
+ formatstr(errorString,"Failed to read job arguments: %s\n",
arg_errors.Value());
delete rsl;
return NULL;
@@ -962,7 +962,7 @@ std::string *NordugridJob::buildSubmitRSL()
dprintf(D_ALWAYS,
"(%d.%d) Failed to get job arguments: %s\n",
procID.cluster,procID.proc,arg_errors.Value());
- sprintf(errorString,"Failed to get job arguments: %s\n",
+ formatstr(errorString,"Failed to get job arguments: %s\n",
arg_errors.Value());
delete rsl;
return NULL;
@@ -1118,9 +1118,9 @@ StringList *NordugridJob::buildStageInList()
tmp_list->rewind();
while ( ( filename = tmp_list->next() ) ) {
if ( filename[0] == '/' || IsUrl( filename ) ) {
- sprintf( buf, "%s", filename );
+ formatstr( buf, "%s", filename );
} else {
- sprintf( buf, "%s%s", iwd.c_str(), filename );
+ formatstr( buf, "%s%s", iwd.c_str(), filename );
}
stage_list->append( buf.c_str() );
}
@@ -1206,7 +1206,7 @@ StringList *NordugridJob::buildStageOutLocalList( StringList *stage_list )
|| IsUrl( local_name.Value() ) ) {
buff = local_name;
} else {
- sprintf( buff, "%s%s", iwd.c_str(), local_name.Value() );
+ formatstr( buff, "%s%s", iwd.c_str(), local_name.Value() );
}
stage_local_list->append( buff.c_str() );
}
diff --git a/src/condor_gridmanager/nordugridresource.cpp b/src/condor_gridmanager/nordugridresource.cpp
index d39e06e..56e2332 100644
--- a/src/condor_gridmanager/nordugridresource.cpp
+++ b/src/condor_gridmanager/nordugridresource.cpp
@@ -38,7 +38,7 @@ const char *NordugridResource::HashName( const char *resource_name,
{
static std::string hash_name;
- sprintf( hash_name, "nordugrid %s#%s", resource_name,
+ formatstr( hash_name, "nordugrid %s#%s", resource_name,
proxy_subject ? proxy_subject : "NULL" );
return hash_name.c_str();
@@ -77,7 +77,7 @@ NordugridResource::NordugridResource( const char *resource_name,
gahp = NULL;
std::string buff;
- sprintf( buff, "NORDUGRID/%s", proxyFQAN );
+ formatstr( buff, "NORDUGRID/%s", proxyFQAN );
gahp = new GahpClient( buff.c_str() );
gahp->setNotificationTimerId( pingTimerId );
@@ -202,7 +202,7 @@ void NordugridResource::DoJobStatus()
}
std::string filter;
- sprintf( filter, "(&(objectclass=nordugrid-job)(nordugrid-job-globalowner=%s))", proxySubject );
+ formatstr( filter, "(&(objectclass=nordugrid-job)(nordugrid-job-globalowner=%s))", proxySubject );
int rc = m_statusGahp->nordugrid_ldap_query( ldap_server.c_str(), "mds-vo-name=local,o=grid", filter.c_str(), "nordugrid-job-globalid,nordugrid-job-status",
results );
if ( rc != GAHPCLIENT_COMMAND_PENDING ) {
@@ -252,7 +252,7 @@ void NordugridResource::DoJobStatus()
if ( next_job_id && next_status ) {
int rc2;
NordugridJob *job;
- sprintf( key, "nordugrid %s %s", resourceName,
+ formatstr( key, "nordugrid %s %s", resourceName,
strrchr( next_job_id, '/' ) + 1 );
rc2 = BaseJob::JobsByRemoteId.lookup( HashKey( key.c_str() ),
(BaseJob*&)job );
diff --git a/src/condor_gridmanager/proxymanager.cpp b/src/condor_gridmanager/proxymanager.cpp
index b75b9c1..821d484 100644
--- a/src/condor_gridmanager/proxymanager.cpp
+++ b/src/condor_gridmanager/proxymanager.cpp
@@ -72,7 +72,7 @@ SetMasterProxy( Proxy *master, const Proxy *copy_src )
int rc;
std::string tmp_file;
- sprintf( tmp_file, "%s.tmp", master->proxy_filename );
+ formatstr( tmp_file, "%s.tmp", master->proxy_filename );
rc = copy_file( copy_src->proxy_filename, tmp_file.c_str() );
if ( rc != 0 ) {
@@ -189,7 +189,7 @@ AcquireProxy( const ClassAd *job_ad, std::string &error,
if ( job_ad->LookupString( ATTR_OWNER, owner ) ) {
std::string param_name;
- sprintf( param_name, "JOB_PROXY_OVERRIDE_FILE_%s", owner.c_str() );
+ formatstr( param_name, "JOB_PROXY_OVERRIDE_FILE_%s", owner.c_str() );
param_str = param( param_name.c_str() );
}
if ( param_str == NULL ) {
@@ -230,7 +230,7 @@ AcquireProxy( const ClassAd *job_ad, std::string &error,
// Create a master proxy for our new ProxySubject
Proxy *new_master = new Proxy;
new_master->id = next_proxy_id++;
- sprintf( tmp, "%s/master_proxy.%d", masterProxyDirectory,
+ formatstr( tmp, "%s/master_proxy.%d", masterProxyDirectory,
new_master->id );
new_master->proxy_filename = strdup( tmp.c_str() );
new_master->num_references = 0;
@@ -374,7 +374,7 @@ AcquireProxy( const ClassAd *job_ad, std::string &error,
// Create a master proxy for our new ProxySubject
Proxy *new_master = new Proxy;
new_master->id = next_proxy_id++;
- sprintf( tmp, "%s/master_proxy.%d", masterProxyDirectory,
+ formatstr( tmp, "%s/master_proxy.%d", masterProxyDirectory,
new_master->id );
new_master->proxy_filename = strdup( tmp.c_str() );
new_master->num_references = 0;
@@ -808,14 +808,14 @@ int RefreshProxyThruMyProxy(Proxy * proxy)
std::string buff;
if (myProxyEntry->myproxy_server_dn) {
- sprintf( buff, "MYPROXY_SERVER_DN=%s",
+ formatstr( buff, "MYPROXY_SERVER_DN=%s",
myProxyEntry->myproxy_server_dn);
myEnv.SetEnv(buff.c_str());
dprintf (D_FULLDEBUG, "%s\n", buff.c_str());
}
- sprintf(buff, "X509_USER_PROXY=%s", proxy_filename);
+ formatstr(buff, "X509_USER_PROXY=%s", proxy_filename);
myEnv.SetEnv (buff.c_str());
dprintf (D_FULLDEBUG, "%s\n", buff.c_str());
diff --git a/src/condor_gridmanager/transferrequest.cpp b/src/condor_gridmanager/transferrequest.cpp
index 931b659..f4a1992 100644
--- a/src/condor_gridmanager/transferrequest.cpp
+++ b/src/condor_gridmanager/transferrequest.cpp
@@ -39,7 +39,7 @@ TransferRequest::TransferRequest( Proxy *proxy, const StringList &src_list,
"TransferRequest::CheckRequest", (Service*)this );
if ( m_src_urls.number() != m_dst_urls.number() ) {
- sprintf( m_errMsg, "Unenven number of source and destination URLs" );
+ formatstr( m_errMsg, "Unenven number of source and destination URLs" );
m_status = TransferFailed;
return;
}
@@ -47,11 +47,11 @@ TransferRequest::TransferRequest( Proxy *proxy, const StringList &src_list,
std::string buff;
char *gahp_path = param( "NORDUGRID_GAHP" );
if ( gahp_path == NULL ) {
- sprintf( m_errMsg, "NORDUGRID_GAHP not defined" );
+ formatstr( m_errMsg, "NORDUGRID_GAHP not defined" );
m_status = TransferFailed;
return;
}
- sprintf( buff, "NORDUGRID/%s", m_proxy->subject->fqan );
+ formatstr( buff, "NORDUGRID/%s", m_proxy->subject->fqan );
m_gahp = new GahpClient( buff.c_str(), gahp_path );
m_gahp->setNotificationTimerId( m_CheckRequest_tid );
m_gahp->setMode( GahpClient::normal );
@@ -95,7 +95,7 @@ void TransferRequest::CheckRequest()
int rc = m_gahp->gridftp_transfer( first_src, first_dst );
if ( rc != GAHPCLIENT_COMMAND_PENDING ) {
- sprintf( m_errMsg, "Failed to start transfer request" );
+ formatstr( m_errMsg, "Failed to start transfer request" );
m_status = TransferFailed;
daemonCore->Reset_Timer( m_notify_tid, 0 );
return;
@@ -107,7 +107,7 @@ void TransferRequest::CheckRequest()
return;
}
if ( rc != 0 ) {
- sprintf( m_errMsg, "Transfer failed: %s", m_gahp->getErrorString() );
+ formatstr( m_errMsg, "Transfer failed: %s", m_gahp->getErrorString() );
m_status = TransferFailed;
daemonCore->Reset_Timer( m_notify_tid, 0 );
return;
@@ -124,7 +124,7 @@ void TransferRequest::CheckRequest()
rc = m_gahp->gridftp_transfer( next_src, next_dst );
if ( rc != GAHPCLIENT_COMMAND_PENDING ) {
- sprintf( m_errMsg, "Failed to start transfer request" );
+ formatstr( m_errMsg, "Failed to start transfer request" );
m_status = TransferFailed;
daemonCore->Reset_Timer( m_notify_tid, 0 );
return;
diff --git a/src/condor_gridmanager/unicorejob.cpp b/src/condor_gridmanager/unicorejob.cpp
index 48b7f75..7f5db65 100644
--- a/src/condor_gridmanager/unicorejob.cpp
+++ b/src/condor_gridmanager/unicorejob.cpp
@@ -230,7 +230,7 @@ UnicoreJob::UnicoreJob( ClassAd *classad )
token = GetNextToken( " ", false );
if ( !token || strcasecmp( token, "unicore" ) ) {
- sprintf( error_string, "%s not of type unicore", ATTR_GRID_JOB_ID );
+ formatstr( error_string, "%s not of type unicore", ATTR_GRID_JOB_ID );
goto error_exit;
}
@@ -238,7 +238,7 @@ UnicoreJob::UnicoreJob( ClassAd *classad )
GetNextToken( " ", false );
token = GetNextToken( " ", false );
if ( !token ) {
- sprintf( error_string, "%s missing job ID",
+ formatstr( error_string, "%s missing job ID",
ATTR_GRID_JOB_ID );
goto error_exit;
}
@@ -808,7 +808,7 @@ void UnicoreJob::SetRemoteJobId( const char *job_id )
std::string full_job_id;
if ( job_id ) {
- sprintf( full_job_id, "%s %s", resourceName, job_id );
+ formatstr( full_job_id, "%s %s", resourceName, job_id );
}
BaseJob::SetRemoteJobId( full_job_id.c_str() );
}
diff --git a/src/condor_negotiator.V6/Accountant.cpp b/src/condor_negotiator.V6/Accountant.cpp
index d15f65d..53e5f02 100644
--- a/src/condor_negotiator.V6/Accountant.cpp
+++ b/src/condor_negotiator.V6/Accountant.cpp
@@ -1099,52 +1099,52 @@ ClassAd* Accountant::ReportState(bool rollup) {
int snum = EntryNum++;
string tmp;
- sprintf(tmp, "Name%d", snum);
+ formatstr(tmp, "Name%d", snum);
ad->Assign(tmp.c_str(), CustomerName);
- sprintf(tmp, "IsAccountingGroup%d", snum);
+ formatstr(tmp, "IsAccountingGroup%d", snum);
ad->Assign(tmp.c_str(), isGroup);
- sprintf(tmp, "AccountingGroup%d", snum);
+ formatstr(tmp, "AccountingGroup%d", snum);
ad->Assign(tmp.c_str(), cgname);
float Priority = GetPriority(CustomerName);
- sprintf(tmp, "Priority%d", snum);
+ formatstr(tmp, "Priority%d", snum);
ad->Assign(tmp.c_str(), Priority);
float PriorityFactor = 0;
if (CustomerAd->LookupFloat(PriorityFactorAttr,PriorityFactor)==0) PriorityFactor=0;
- sprintf(tmp, "PriorityFactor%d", snum);
+ formatstr(tmp, "PriorityFactor%d", snum);
ad->Assign(tmp.c_str(), PriorityFactor);
int ResourcesUsed = 0;
if (CustomerAd->LookupInteger(ResourcesUsedAttr,ResourcesUsed)==0) ResourcesUsed=0;
- sprintf(tmp, "ResourcesUsed%d", snum);
+ formatstr(tmp, "ResourcesUsed%d", snum);
ad->Assign(tmp.c_str(), ResourcesUsed);
float WeightedResourcesUsed = 0;
if (CustomerAd->LookupFloat(WeightedResourcesUsedAttr,WeightedResourcesUsed)==0) WeightedResourcesUsed=0;
- sprintf(tmp, "WeightedResourcesUsed%d", snum);
+ formatstr(tmp, "WeightedResourcesUsed%d", snum);
ad->Assign(tmp.c_str(), WeightedResourcesUsed);
float AccumulatedUsage = 0;
if (CustomerAd->LookupFloat(AccumulatedUsageAttr,AccumulatedUsage)==0) AccumulatedUsage=0;
- sprintf(tmp, "AccumulatedUsage%d", snum);
+ formatstr(tmp, "AccumulatedUsage%d", snum);
ad->Assign(tmp.c_str(), AccumulatedUsage);
float WeightedAccumulatedUsage = 0;
if (CustomerAd->LookupFloat(WeightedAccumulatedUsageAttr,WeightedAccumulatedUsage)==0) WeightedAccumulatedUsage=0;
- sprintf(tmp, "WeightedAccumulatedUsage%d", snum);
+ formatstr(tmp, "WeightedAccumulatedUsage%d", snum);
ad->Assign(tmp.c_str(), WeightedAccumulatedUsage);
int BeginUsageTime = 0;
if (CustomerAd->LookupInteger(BeginUsageTimeAttr,BeginUsageTime)==0) BeginUsageTime=0;
- sprintf(tmp, "BeginUsageTime%d", snum);
+ formatstr(tmp, "BeginUsageTime%d", snum);
ad->Assign(tmp.c_str(), BeginUsageTime);
int LastUsageTime = 0;
if (CustomerAd->LookupInteger(LastUsageTimeAttr,LastUsageTime)==0) LastUsageTime=0;
- sprintf(tmp, "LastUsageTime%d", snum);
+ formatstr(tmp, "LastUsageTime%d", snum);
ad->Assign(tmp.c_str(), LastUsageTime);
}
@@ -1183,34 +1183,34 @@ void Accountant::ReportGroups(GroupEntry* group, ClassAd* ad, bool rollup, map<s
}
string tmp;
- sprintf(tmp, "Name%d", gnum);
+ formatstr(tmp, "Name%d", gnum);
ad->Assign(tmp.c_str(), CustomerName);
- sprintf(tmp, "IsAccountingGroup%d", gnum);
+ formatstr(tmp, "IsAccountingGroup%d", gnum);
ad->Assign(tmp.c_str(), isGroup);
- sprintf(tmp, "AccountingGroup%d", gnum);
+ formatstr(tmp, "AccountingGroup%d", gnum);
ad->Assign(tmp.c_str(), cgname);
float Priority = (!rollup) ? GetPriority(CustomerName) : 0;
- sprintf(tmp, "Priority%d", gnum);
+ formatstr(tmp, "Priority%d", gnum);
ad->Assign(tmp.c_str(), Priority);
float PriorityFactor = 0;
if (!rollup && CustomerAd->LookupFloat(PriorityFactorAttr,PriorityFactor)==0) PriorityFactor=0;
- sprintf(tmp, "PriorityFactor%d", gnum);
+ formatstr(tmp, "PriorityFactor%d", gnum);
ad->Assign(tmp.c_str(), PriorityFactor);
if (cgrp) {
- sprintf(tmp, "EffectiveQuota%d", gnum);
+ formatstr(tmp, "EffectiveQuota%d", gnum);
ad->Assign(tmp.c_str(), cgrp->quota);
- sprintf(tmp, "ConfigQuota%d", gnum);
+ formatstr(tmp, "ConfigQuota%d", gnum);
ad->Assign(tmp.c_str(), cgrp->config_quota);
- sprintf(tmp, "SubtreeQuota%d", gnum);
+ formatstr(tmp, "SubtreeQuota%d", gnum);
ad->Assign(tmp.c_str(), cgrp->subtree_quota);
- sprintf(tmp, "GroupSortKey%d", gnum);
+ formatstr(tmp, "GroupSortKey%d", gnum);
ad->Assign(tmp.c_str(), cgrp->sort_key);
- sprintf(tmp, "SurplusPolicy%d", gnum);
+ formatstr(tmp, "SurplusPolicy%d", gnum);
const char * policy = "no";
if (cgrp->autoregroup) policy = "regroup";
else if (cgrp->accept_surplus) policy = "byquota";
@@ -1219,32 +1219,32 @@ void Accountant::ReportGroups(GroupEntry* group, ClassAd* ad, bool rollup, map<s
int ResourcesUsed = 0;
if (CustomerAd->LookupInteger(ResourcesUsedAttr,ResourcesUsed)==0) ResourcesUsed=0;
- sprintf(tmp, "ResourcesUsed%d", gnum);
+ formatstr(tmp, "ResourcesUsed%d", gnum);
ad->Assign(tmp.c_str(), ResourcesUsed);
float WeightedResourcesUsed = 0;
if (CustomerAd->LookupFloat(WeightedResourcesUsedAttr,WeightedResourcesUsed)==0) WeightedResourcesUsed=0;
- sprintf(tmp, "WeightedResourcesUsed%d", gnum);
+ formatstr(tmp, "WeightedResourcesUsed%d", gnum);
ad->Assign(tmp.c_str(), WeightedResourcesUsed);
float AccumulatedUsage = 0;
if (CustomerAd->LookupFloat(AccumulatedUsageAttr,AccumulatedUsage)==0) AccumulatedUsage=0;
- sprintf(tmp, "AccumulatedUsage%d", gnum);
+ formatstr(tmp, "AccumulatedUsage%d", gnum);
ad->Assign(tmp.c_str(), AccumulatedUsage);
float WeightedAccumulatedUsage = 0;
if (CustomerAd->LookupFloat(WeightedAccumulatedUsageAttr,WeightedAccumulatedUsage)==0) WeightedAccumulatedUsage=0;
- sprintf(tmp, "WeightedAccumulatedUsage%d", gnum);
+ formatstr(tmp, "WeightedAccumulatedUsage%d", gnum);
ad->Assign(tmp.c_str(), WeightedAccumulatedUsage);
int BeginUsageTime = 0;
if (CustomerAd->LookupInteger(BeginUsageTimeAttr,BeginUsageTime)==0) BeginUsageTime=0;
- sprintf(tmp, "BeginUsageTime%d", gnum);
+ formatstr(tmp, "BeginUsageTime%d", gnum);
ad->Assign(tmp.c_str(), BeginUsageTime);
int LastUsageTime = 0;
if (CustomerAd->LookupInteger(LastUsageTimeAttr,LastUsageTime)==0) LastUsageTime=0;
- sprintf(tmp, "LastUsageTime%d", gnum);
+ formatstr(tmp, "LastUsageTime%d", gnum);
ad->Assign(tmp.c_str(), LastUsageTime);
// Populate group's children recursively, if it has any
@@ -1263,39 +1263,39 @@ void Accountant::ReportGroups(GroupEntry* group, ClassAd* ad, bool rollup, map<s
float fval = 0;
// roll up values to parent
- sprintf(tmp, "ResourcesUsed%d", gnum);
+ formatstr(tmp, "ResourcesUsed%d", gnum);
ad->LookupInteger(tmp.c_str(), ResourcesUsed);
- sprintf(tmp, "ResourcesUsed%d", pnum);
+ formatstr(tmp, "ResourcesUsed%d", pnum);
ad->LookupInteger(tmp.c_str(), ival);
ad->Assign(tmp.c_str(), ival + ResourcesUsed);
- sprintf(tmp, "WeightedResourcesUsed%d", gnum);
+ formatstr(tmp, "WeightedResourcesUsed%d", gnum);
ad->LookupFloat(tmp.c_str(), WeightedResourcesUsed);
- sprintf(tmp, "WeightedResourcesUsed%d", pnum);
+ formatstr(tmp, "WeightedResourcesUsed%d", pnum);
ad->LookupFloat(tmp.c_str(), fval);
ad->Assign(tmp.c_str(), fval + WeightedResourcesUsed);
- sprintf(tmp, "AccumulatedUsage%d", gnum);
+ formatstr(tmp, "AccumulatedUsage%d", gnum);
ad->LookupFloat(tmp.c_str(), AccumulatedUsage);
- sprintf(tmp, "AccumulatedUsage%d", pnum);
+ formatstr(tmp, "AccumulatedUsage%d", pnum);
ad->LookupFloat(tmp.c_str(), fval);
ad->Assign(tmp.c_str(), fval + AccumulatedUsage);
- sprintf(tmp, "WeightedAccumulatedUsage%d", gnum);
+ formatstr(tmp, "WeightedAccumulatedUsage%d", gnum);
ad->LookupFloat(tmp.c_str(), WeightedAccumulatedUsage);
- sprintf(tmp, "WeightedAccumulatedUsage%d", pnum);
+ formatstr(tmp, "WeightedAccumulatedUsage%d", pnum);
ad->LookupFloat(tmp.c_str(), fval);
ad->Assign(tmp.c_str(), fval + WeightedAccumulatedUsage);
- sprintf(tmp, "BeginUsageTime%d", gnum);
+ formatstr(tmp, "BeginUsageTime%d", gnum);
ad->LookupInteger(tmp.c_str(), BeginUsageTime);
- sprintf(tmp, "BeginUsageTime%d", pnum);
+ formatstr(tmp, "BeginUsageTime%d", pnum);
ad->LookupInteger(tmp.c_str(), ival);
ad->Assign(tmp.c_str(), std::min(ival, BeginUsageTime));
- sprintf(tmp, "LastUsageTime%d", gnum);
+ formatstr(tmp, "LastUsageTime%d", gnum);
ad->LookupInteger(tmp.c_str(), LastUsageTime);
- sprintf(tmp, "LastUsageTime%d", pnum);
+ formatstr(tmp, "LastUsageTime%d", pnum);
ad->LookupInteger(tmp.c_str(), ival);
ad->Assign(tmp.c_str(), std::max(ival, LastUsageTime));
}
@@ -1678,7 +1678,7 @@ void Accountant::ReportLimits(AttrList *attrList)
concurrencyLimits.startIterations();
while (concurrencyLimits.iterate(limit, count)) {
string attr;
- sprintf(attr, "ConcurrencyLimit_%s", limit.Value());
+ formatstr(attr, "ConcurrencyLimit_%s", limit.Value());
// classad wire protocol doesn't currently support attribute names that include
// punctuation or symbols outside of '_'. If we want to include '.' or any other
// punct, we need to either model these as string values, or add support for quoted
diff --git a/src/condor_negotiator.V6/matchmaker.cpp b/src/condor_negotiator.V6/matchmaker.cpp
index c0367e2..064a8e4 100644
--- a/src/condor_negotiator.V6/matchmaker.cpp
+++ b/src/condor_negotiator.V6/matchmaker.cpp
@@ -4250,7 +4250,7 @@ matchmakingProtocol (ClassAd &request, ClassAd *offer,
strcpy(remoteOwner, "none");
}
if (offer->LookupString(ATTR_ACCOUNTING_GROUP, accountingGroup)) {
- sprintf(remoteUser,"%s (%s=%s)",
+ formatstr(remoteUser,"%s (%s=%s)",
remoteOwner,ATTR_ACCOUNTING_GROUP,accountingGroup);
} else {
remoteUser = remoteOwner;
diff --git a/src/condor_q.V6/queue.cpp b/src/condor_q.V6/queue.cpp
index 58ff6ed..e320816 100644
--- a/src/condor_q.V6/queue.cpp
+++ b/src/condor_q.V6/queue.cpp
@@ -1364,7 +1364,7 @@ processCommandLineArguments (int argc, char *argv[])
else
if (match_prefix( arg, "run")) {
std::string expr;
- sprintf( expr, "%s == %d || %s == %d || %s == %d", ATTR_JOB_STATUS, RUNNING,
+ formatstr( expr, "%s == %d || %s == %d || %s == %d", ATTR_JOB_STATUS, RUNNING,
ATTR_JOB_STATUS, TRANSFERRING_OUTPUT, ATTR_JOB_STATUS, SUSPENDED );
Q.addAND( expr.c_str() );
run = true;
diff --git a/src/condor_schedd.V6/dedicated_scheduler.cpp b/src/condor_schedd.V6/dedicated_scheduler.cpp
index d307ee6..b5c5d12 100644
--- a/src/condor_schedd.V6/dedicated_scheduler.cpp
+++ b/src/condor_schedd.V6/dedicated_scheduler.cpp
@@ -1314,7 +1314,7 @@ DedicatedScheduler::sortJobs( void )
std::string fifoConstraint;
// "JobUniverse == PARALLEL_UNIVERSE && JobStatus == HELD && HoldReasonCode == HOLD_SpoolingInput
- sprintf(fifoConstraint, "%s == %d && %s == %d && %s == %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_PARALLEL,
+ formatstr(fifoConstraint, "%s == %d && %s == %d && %s == %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_PARALLEL,
ATTR_JOB_STATUS, HELD,
ATTR_HOLD_REASON_CODE, CONDOR_HOLD_CODE_SpoolingInput);
ClassAd *spoolingInJob = GetJobByConstraint(fifoConstraint.c_str());
diff --git a/src/condor_schedd.V6/qmgmt.cpp b/src/condor_schedd.V6/qmgmt.cpp
index 9cde502..e5e46c6 100644
--- a/src/condor_schedd.V6/qmgmt.cpp
+++ b/src/condor_schedd.V6/qmgmt.cpp
@@ -605,7 +605,7 @@ static void
RenamePre_7_5_5_SpoolPathsInJob( ClassAd *job_ad, char const *spool, int cluster, int proc )
{
std::string old_path;
- sprintf(old_path,"%s%ccluster%d.proc%d.subproc%d", spool, DIR_DELIM_CHAR, cluster, proc, 0);
+ formatstr(old_path,"%s%ccluster%d.proc%d.subproc%d", spool, DIR_DELIM_CHAR, cluster, proc, 0);
char *new_path = gen_ckpt_name( spool, cluster, proc, 0 );
ASSERT( new_path );
@@ -763,10 +763,10 @@ SpoolHierarchyChangePass2(char const *spool,std::list< PROC_ID > &spool_rename_l
char *tmp;
if( proc == ICKPT ) {
- sprintf(old_path,"%s%ccluster%d.ickpt.subproc%d",spool,DIR_DELIM_CHAR,cluster,0);
+ formatstr(old_path,"%s%ccluster%d.ickpt.subproc%d",spool,DIR_DELIM_CHAR,cluster,0);
}
else {
- sprintf(old_path,"%s%ccluster%d.proc%d.subproc%d",spool,DIR_DELIM_CHAR,cluster,proc,0);
+ formatstr(old_path,"%s%ccluster%d.proc%d.subproc%d",spool,DIR_DELIM_CHAR,cluster,proc,0);
}
tmp = gen_ckpt_name(spool,cluster,proc,0);
new_path = tmp;
diff --git a/src/condor_schedd.V6/schedd.cpp b/src/condor_schedd.V6/schedd.cpp
index b855407..ff87256 100644
--- a/src/condor_schedd.V6/schedd.cpp
+++ b/src/condor_schedd.V6/schedd.cpp
@@ -7652,7 +7652,7 @@ Scheduler::start_sched_universe_job(PROC_ID* job_id)
// the IWD.
if ( !fullpath( a_out_name.Value() ) ) {
std::string tmp = a_out_name;
- sprintf( a_out_name, "%s%c%s", iwd.Value(), DIR_DELIM_CHAR, tmp.c_str() );
+ formatstr( a_out_name, "%s%c%s", iwd.Value(), DIR_DELIM_CHAR, tmp.c_str() );
}
// Now check, as the user, if we may execute it.
@@ -8114,7 +8114,7 @@ Scheduler::InsertMachineAttrs( int cluster, int proc, ClassAd *machine_ad )
std::string slot_name;
machine_ad->LookupString(ATTR_NAME,slot_name);
- sprintf(attr_buf,"%s0",ATTR_LAST_MATCH_LIST_PREFIX);
+ formatstr(attr_buf,"%s0",ATTR_LAST_MATCH_LIST_PREFIX);
SetAttributeString(cluster,proc,attr_buf.c_str(),slot_name.c_str());
}
diff --git a/src/condor_startd.V6/ResAttributes.cpp b/src/condor_startd.V6/ResAttributes.cpp
index 0c045d7..f820412 100644
--- a/src/condor_startd.V6/ResAttributes.cpp
+++ b/src/condor_startd.V6/ResAttributes.cpp
@@ -582,7 +582,7 @@ void MachAttributes::init_machine_resources() {
// If MACHINE_RESOURCE_<rname> is present, use that and move on:
string pname;
- sprintf(pname, "MACHINE_RESOURCE_%s", rname.c_str());
+ formatstr(pname, "MACHINE_RESOURCE_%s", rname.c_str());
char* machresp = param(pname.c_str());
if (machresp) {
int v = param_integer(pname.c_str(), 0, 0, INT_MAX);
@@ -594,7 +594,7 @@ void MachAttributes::init_machine_resources() {
// current definition of REMIND macro is not working with gcc
#pragma message("MACHINE_RESOURCE_INVENTORY_<rname> is deprecated, and will be removed when a solution using '|' in config files is fleshed out")
// if we didn't find MACHINE_RESOURCE_<rname>, then try MACHINE_RESOURCE_INVENTORY_<rname>
- sprintf(pname, "MACHINE_RESOURCE_INVENTORY_%s", rname.c_str());
+ formatstr(pname, "MACHINE_RESOURCE_INVENTORY_%s", rname.c_str());
char* invscriptp = param(pname.c_str());
if (NULL == invscriptp) {
EXCEPT("Missing configuration for local machine resource %s", rname.c_str());
@@ -629,7 +629,7 @@ void MachAttributes::init_machine_resources() {
string ccname(rname.c_str());
*(ccname.begin()) = toupper(*(ccname.begin()));
string detname;
- sprintf(detname, "%s%s", ATTR_DETECTED_PREFIX, ccname.c_str());
+ formatstr(detname, "%s%s", ATTR_DETECTED_PREFIX, ccname.c_str());
int v = 0;
if (!invad.LookupInteger(detname.c_str(), v)) {
EXCEPT("Missing required attribute \"%s = <n>\" from output of %s\n", detname.c_str(), invscript.c_str());
@@ -827,9 +827,9 @@ MachAttributes::publish( ClassAd* cp, amask_t how_much)
string rname(j->first.c_str());
*(rname.begin()) = toupper(*(rname.begin()));
string attr;
- sprintf(attr, "%s%s", ATTR_DETECTED_PREFIX, rname.c_str());
+ formatstr(attr, "%s%s", ATTR_DETECTED_PREFIX, rname.c_str());
cp->Assign(attr.c_str(), int(j->second));
- sprintf(attr, "%s%s", ATTR_TOTAL_PREFIX, rname.c_str());
+ formatstr(attr, "%s%s", ATTR_TOTAL_PREFIX, rname.c_str());
cp->Assign(attr.c_str(), int(j->second));
machine_resources += " ";
machine_resources += j->first;
@@ -1068,9 +1068,9 @@ CpuAttributes::publish( ClassAd* cp, amask_t how_much )
string rname(j->first.c_str());
*(rname.begin()) = toupper(*(rname.begin()));
string attr;
- sprintf(attr, "%s%s", "", rname.c_str());
+ formatstr(attr, "%s%s", "", rname.c_str());
cp->Assign(attr.c_str(), int(j->second));
- sprintf(attr, "%s%s", ATTR_TOTAL_SLOT_PREFIX, rname.c_str());
+ formatstr(attr, "%s%s", ATTR_TOTAL_SLOT_PREFIX, rname.c_str());
cp->Assign(attr.c_str(), int(c_slottot_map[j->first]));
}
}
diff --git a/src/condor_startd.V6/ResMgr.cpp b/src/condor_startd.V6/ResMgr.cpp
index 82db576..54f4c2d 100644
--- a/src/condor_startd.V6/ResMgr.cpp
+++ b/src/condor_startd.V6/ResMgr.cpp
@@ -2527,17 +2527,17 @@ ResMgr::startDraining(int how_fast,bool resume_on_completion,ExprTree *check_exp
classad::EvalState eval_state;
eval_state.SetScopes( resources[i]->r_classad );
if( !check_expr->Evaluate( eval_state, v ) ) {
- sprintf(error_msg,"Failed to evaluate draining check expression against %s.", resources[i]->r_name );
+ formatstr(error_msg,"Failed to evaluate draining check expression against %s.", resources[i]->r_name );
error_code = DRAINING_CHECK_EXPR_FAILED;
return false;
}
if( !v.IsBooleanValue(check_ok) ) {
- sprintf(error_msg,"Draining check expression does not evaluate to a bool on %s.", resources[i]->r_name );
+ formatstr(error_msg,"Draining check expression does not evaluate to a bool on %s.", resources[i]->r_name );
error_code = DRAINING_CHECK_EXPR_FAILED;
return false;
}
if( !check_ok ) {
- sprintf(error_msg,"Draining check expression is false on %s.", resources[i]->r_name );
+ formatstr(error_msg,"Draining check expression is false on %s.", resources[i]->r_name );
error_code = DRAINING_CHECK_EXPR_FAILED;
return false;
}
@@ -2547,7 +2547,7 @@ ResMgr::startDraining(int how_fast,bool resume_on_completion,ExprTree *check_exp
draining = true;
last_drain_start_time = time(NULL);
draining_id += 1;
- sprintf(new_request_id,"%d",draining_id);
+ formatstr(new_request_id,"%d",draining_id);
this->resume_on_completion_of_draining = resume_on_completion;
if( how_fast <= DRAIN_GRACEFUL ) {
@@ -2596,7 +2596,7 @@ ResMgr::cancelDraining(std::string request_id,std::string &error_msg,int &error_
}
if( !request_id.empty() && atoi(request_id.c_str()) != this->draining_id ) {
- sprintf(error_msg,"No matching draining request id %s.",request_id.c_str());
+ formatstr(error_msg,"No matching draining request id %s.",request_id.c_str());
error_code = DRAINING_NO_MATCHING_REQUEST_ID;
return false;
}
@@ -2688,7 +2688,7 @@ ResMgr::getDrainingRequestId( Resource * /*rip*/, std::string &request_id )
if( !draining ) {
return false;
}
- sprintf(request_id,"%d",draining_id);
+ formatstr(request_id,"%d",draining_id);
return true;
}
diff --git a/src/condor_startd.V6/Resource.cpp b/src/condor_startd.V6/Resource.cpp
index 81600f5..18cca2e 100644
--- a/src/condor_startd.V6/Resource.cpp
+++ b/src/condor_startd.V6/Resource.cpp
@@ -2861,11 +2861,11 @@ Resource * initialize_resource(Resource * rip, ClassAd * req_classad, Claim* &le
for (CpuAttributes::slotres_map_t::const_iterator j(rip->r_attr->get_slotres_map().begin()); j != rip->r_attr->get_slotres_map().end(); ++j) {
string reqname;
- sprintf(reqname, "%s%s", ATTR_REQUEST_PREFIX, j->first.c_str());
+ formatstr(reqname, "%s%s", ATTR_REQUEST_PREFIX, j->first.c_str());
int reqval = 0;
if (!req_classad->EvalInteger(reqname.c_str(), mach_classad, reqval)) reqval = 0;
string attr;
- sprintf(attr, " %s=%d", j->first.c_str(), reqval);
+ formatstr(attr, " %s=%d", j->first.c_str(), reqval);
type += attr;
}
diff --git a/src/condor_status.V6/status.cpp b/src/condor_status.V6/status.cpp
index dea2c92..988a395 100644
--- a/src/condor_status.V6/status.cpp
+++ b/src/condor_status.V6/status.cpp
@@ -840,18 +840,18 @@ firstPass (int argc, char *argv[])
ss.expr = sortExpr;
ss.arg = argv[i];
- sprintf(ss.keyAttr, "CondorStatusSortKey%d", jsort);
- sprintf(ss.keyExprAttr, "CondorStatusSortKeyExpr%d", jsort);
+ formatstr(ss.keyAttr, "CondorStatusSortKey%d", jsort);
+ formatstr(ss.keyExprAttr, "CondorStatusSortKeyExpr%d", jsort);
string exprString;
- sprintf(exprString, "MY.%s < TARGET.%s", ss.keyAttr.c_str(), ss.keyAttr.c_str());
+ formatstr(exprString, "MY.%s < TARGET.%s", ss.keyAttr.c_str(), ss.keyAttr.c_str());
if (ParseClassAdRvalExpr(exprString.c_str(), sortExpr)) {
fprintf(stderr, "Error: Parse error of: %s\n", exprString.c_str());
exit(1);
}
ss.exprLT = sortExpr;
- sprintf(exprString, "MY.%s == TARGET.%s", ss.keyAttr.c_str(), ss.keyAttr.c_str());
+ formatstr(exprString, "MY.%s == TARGET.%s", ss.keyAttr.c_str(), ss.keyAttr.c_str());
if (ParseClassAdRvalExpr(exprString.c_str(), sortExpr)) {
fprintf(stderr, "Error: Parse error of: %s\n", exprString.c_str());
exit(1);
diff --git a/src/condor_submit.V6/submit.cpp b/src/condor_submit.V6/submit.cpp
index 76bbabf..0349839 100644
--- a/src/condor_submit.V6/submit.cpp
+++ b/src/condor_submit.V6/submit.cpp
@@ -2523,7 +2523,7 @@ void SetRequestResources() {
// could get this from 'it', but this prevents unused-line warnings:
std::string val = condor_param(key.c_str());
std::string assign;
- sprintf(assign, "%s%s = %s", ATTR_REQUEST_PREFIX, rname.c_str(), val.c_str());
+ formatstr(assign, "%s%s = %s", ATTR_REQUEST_PREFIX, rname.c_str(), val.c_str());
InsertJobExpr(assign.c_str());
}
hash_iter_delete(&it);
@@ -6825,7 +6825,7 @@ check_requirements( char const *orig, MyString &answer )
// CamelCase it!
*(rname.begin()) = toupper(*(rname.begin()));
std::string clause;
- sprintf(clause, " && (TARGET.%s%s >= %s%s)", "", rname.c_str(), ATTR_REQUEST_PREFIX, rname.c_str());
+ formatstr(clause, " && (TARGET.%s%s >= %s%s)", "", rname.c_str(), ATTR_REQUEST_PREFIX, rname.c_str());
answer += clause;
}
hash_iter_delete(&it);
diff --git a/src/condor_tools/history.cpp b/src/condor_tools/history.cpp
index c64281d..2b7fffb 100644
--- a/src/condor_tools/history.cpp
+++ b/src/condor_tools/history.cpp
@@ -234,7 +234,7 @@ main(int argc, char* argv[])
}
else if (is_dash_arg_prefix(argv[i],"constraint",1)) {
if (i+1==argc || constraint!="") break;
- sprintf(constraint,"(%s)",argv[i+1]);
+ formatstr(constraint,"(%s)",argv[i+1]);
i++;
//readfromfile = true;
}
@@ -263,7 +263,7 @@ main(int argc, char* argv[])
fprintf(stderr, "Error: Cannot provide both -constraint and <cluster>.<proc>\n");
break;
}
- sprintf (constraint, "((%s == %d) && (%s == %d))",
+ formatstr (constraint, "((%s == %d) && (%s == %d))",
ATTR_CLUSTER_ID, cluster,ATTR_PROC_ID, proc);
parameters[0] = &cluster;
parameters[1] = &proc;
@@ -277,7 +277,7 @@ main(int argc, char* argv[])
fprintf(stderr, "Error: Cannot provide both -constraint and <cluster>\n");
break;
}
- sprintf (constraint, "(%s == %d)", ATTR_CLUSTER_ID, cluster);
+ formatstr (constraint, "(%s == %d)", ATTR_CLUSTER_ID, cluster);
parameters[0] = &cluster;
#ifdef HAVE_EXT_POSTGRESQL
queryhor.setQuery(HISTORY_CLUSTER_HOR, parameters);
@@ -297,7 +297,7 @@ main(int argc, char* argv[])
}
owner = (char *) malloc(512 * sizeof(char));
sscanf(argv[i], "%s", owner);
- sprintf(constraint, "(%s == \"%s\")", ATTR_OWNER, owner);
+ formatstr(constraint, "(%s == \"%s\")", ATTR_OWNER, owner);
parameters[0] = owner;
#ifdef HAVE_EXT_POSTGRESQL
queryhor.setQuery(HISTORY_OWNER_HOR, parameters);
diff --git a/src/condor_tools/preen.cpp b/src/condor_tools/preen.cpp
index 57fcd04..3425d4b 100644
--- a/src/condor_tools/preen.cpp
+++ b/src/condor_tools/preen.cpp
@@ -269,7 +269,7 @@ check_job_spool_hierarchy( char const *parent, char const *child, StringList &ba
}
std::string topdir;
- sprintf(topdir,"%s%c%s",parent,DIR_DELIM_CHAR,child);
+ formatstr(topdir,"%s%c%s",parent,DIR_DELIM_CHAR,child);
Directory dir(topdir.c_str(),PRIV_ROOT);
char const *f;
while( (f=dir.Next()) ) {
diff --git a/src/condor_utils/condor_config.cpp b/src/condor_utils/condor_config.cpp
index 10b3fa1..596abf2 100644
--- a/src/condor_utils/condor_config.cpp
+++ b/src/condor_utils/condor_config.cpp
@@ -1123,7 +1123,7 @@ find_file(const char *env_name, const char *file_name)
// 1) $HOME/.condor/condor_config
struct passwd *pw = getpwuid( geteuid() );
if ( !can_switch_ids() && pw && pw->pw_dir ) {
- sprintf( locations[0], "%s/.%s/%s", pw->pw_dir, myDistro->Get(),
+ formatstr( locations[0], "%s/.%s/%s", pw->pw_dir, myDistro->Get(),
file_name );
}
// 2) /etc/condor/condor_config
diff --git a/src/condor_utils/condor_event.cpp b/src/condor_utils/condor_event.cpp
index 16ce04d..016f991 100644
--- a/src/condor_utils/condor_event.cpp
+++ b/src/condor_utils/condor_event.cpp
@@ -687,13 +687,13 @@ static void readUsageAd(FILE * file, /* in,out */ ClassAd ** ppusageAd)
pszTbl[ixUse] = 0;
pszTbl[ixReq] = 0;
std::string exprstr;
- sprintf(exprstr, "%sUsage = %s", pszLbl, pszTbl);
+ formatstr(exprstr, "%sUsage = %s", pszLbl, pszTbl);
puAd->Insert(exprstr.c_str());
- sprintf(exprstr, "Request%s = %s", pszLbl, &pszTbl[ixUse+1]);
+ formatstr(exprstr, "Request%s = %s", pszLbl, &pszTbl[ixUse+1]);
puAd->Insert(exprstr.c_str());
if (ixAlloc > 0) {
pszTbl[ixAlloc] = 0;
- sprintf(exprstr, "%s = %s", pszLbl, &pszTbl[ixReq+1]);
+ formatstr(exprstr, "%s = %s", pszLbl, &pszTbl[ixReq+1]);
puAd->Insert(exprstr.c_str());
}
}
diff --git a/src/condor_utils/dprintf_config.cpp b/src/condor_utils/dprintf_config.cpp
index e7faabb..b9d6119 100644
--- a/src/condor_utils/dprintf_config.cpp
+++ b/src/condor_utils/dprintf_config.cpp
@@ -261,7 +261,7 @@ dprintf_config( const char *subsys, param_functions *p_funcs, struct dprintf_out
EXCEPT("Unable to find LOG or SUBSYSTEM.\n");
}
- sprintf(logPath, "%s%c%sLog", DebugLogDir, DIR_DELIM_CHAR, lsubsys);
+ formatstr(logPath, "%s%c%sLog", DebugLogDir, DIR_DELIM_CHAR, lsubsys);
free(lsubsys);
}
@@ -340,7 +340,7 @@ dprintf_config( const char *subsys, param_functions *p_funcs, struct dprintf_out
bool r = lex_cast(pval, maxlog);
if (!r || (maxlog < 0)) {
std::string m;
- sprintf(m, "Invalid config %s = %s: %s must be an integer literal >= 0\n", pname, pval, pname);
+ formatstr(m, "Invalid config %s = %s: %s must be an integer literal >= 0\n", pname, pval, pname);
_condor_dprintf_exit(EINVAL, m.c_str());
}
DebugParams[param_index].maxLog = maxlog;
diff --git a/src/condor_utils/spool_version.cpp b/src/condor_utils/spool_version.cpp
index 916c84f..affd993 100644
--- a/src/condor_utils/spool_version.cpp
+++ b/src/condor_utils/spool_version.cpp
@@ -29,7 +29,7 @@ CheckSpoolVersion(char const *spool, int spool_min_version_i_support, int spool_
spool_cur_version = 0;
std::string vers_fname;
- sprintf(vers_fname,"%s%cspool_version",spool,DIR_DELIM_CHAR);
+ formatstr(vers_fname,"%s%cspool_version",spool,DIR_DELIM_CHAR);
FILE *vers_file = safe_fopen_wrapper_follow(vers_fname.c_str(),"r");
if( vers_file ) {
@@ -86,7 +86,7 @@ void CheckSpoolVersion(
void
WriteSpoolVersion(char const *spool,int spool_min_version_i_write,int spool_cur_version_i_support) {
std::string vers_fname;
- sprintf(vers_fname,"%s%cspool_version",spool,DIR_DELIM_CHAR);
+ formatstr(vers_fname,"%s%cspool_version",spool,DIR_DELIM_CHAR);
FILE *vers_file = safe_fcreate_replace_if_exists(vers_fname.c_str(),"w");
if( !vers_file ) {
diff --git a/src/condor_utils/user_job_policy.cpp b/src/condor_utils/user_job_policy.cpp
index a481960..1fb0c0e 100644
--- a/src/condor_utils/user_job_policy.cpp
+++ b/src/condor_utils/user_job_policy.cpp
@@ -640,8 +640,8 @@ bool UserPolicy::FiringReason(MyString &reason,int &reason_code,int &reason_subc
}
else {
reason_code = CONDOR_HOLD_CODE_JobPolicy;
- sprintf(reason_expr_attr,"%sReason", m_fire_expr);
- sprintf(subcode_expr_attr,"%sSubCode", m_fire_expr);
+ formatstr(reason_expr_attr,"%sReason", m_fire_expr);
+ formatstr(subcode_expr_attr,"%sSubCode", m_fire_expr);
}
break;
}
@@ -657,8 +657,8 @@ bool UserPolicy::FiringReason(MyString &reason,int &reason_code,int &reason_subc
}
else {
reason_code = CONDOR_HOLD_CODE_SystemPolicy;
- sprintf(reason_expr_param,"%s_REASON", m_fire_expr);
- sprintf(subcode_expr_param,"%s_SUBCODE", m_fire_expr);
+ formatstr(reason_expr_param,"%s_REASON", m_fire_expr);
+ formatstr(subcode_expr_param,"%s_SUBCODE", m_fire_expr);
}
break;
}
diff --git a/src/condor_who/who.cpp b/src/condor_who/who.cpp
index 2b85727..8fc2df6 100644
--- a/src/condor_who/who.cpp
+++ b/src/condor_who/who.cpp
@@ -324,7 +324,7 @@ static void init_program_for_pid(pid_t pid)
cmdargs.AppendArg("ps");
cmdargs.AppendArg("-f");
std::string eqpid;
- sprintf(eqpid, "%u", pid);
+ formatstr(eqpid, "%u", pid);
cmdargs.AppendArg(eqpid.c_str());
const char * fld_name = "CMD";
const int parse_type = 0;
@@ -927,7 +927,7 @@ static void scan_a_log_for_info(LOG_INFO_MAP & info, MAP_TO_PID & job_to_pid, LO
LOG_INFO * pliDaemon = it->second;
std::string filename;
- sprintf(filename, "%s%c%s", pliDaemon->log_dir.c_str(), DIR_DELIM_CHAR, pliDaemon->log.c_str());
+ formatstr(filename, "%s%c%s", pliDaemon->log_dir.c_str(), DIR_DELIM_CHAR, pliDaemon->log.c_str());
if (App.diagnostic) {
printf("scanning %s log file '%s' for pids and addresses\n", pszDaemon, filename.c_str());
printf("using '%s' as banner\n", startup_banner_text.c_str());
diff --git a/src/defrag/defrag.cpp b/src/defrag/defrag.cpp
index 98fa808..cf14a5a 100644
--- a/src/defrag/defrag.cpp
+++ b/src/defrag/defrag.cpp
@@ -273,7 +273,7 @@ Defrag::queryDrainingCost()
startdQuery.setDesiredAttrs(desired_attrs);
std::string query;
// only want one ad per machine
- sprintf(query,"%s==1 && (%s =!= undefined || %s =!= undefined)",
+ formatstr(query,"%s==1 && (%s =!= undefined || %s =!= undefined)",
ATTR_SLOT_ID,
ATTR_TOTAL_MACHINE_DRAINING_UNCLAIMED_TIME,
ATTR_TOTAL_MACHINE_DRAINING_BADPUT);
@@ -377,7 +377,7 @@ void Defrag::saveState()
ad.Assign(ATTR_LAST_POLL,(int)m_last_poll);
std::string new_state_file;
- sprintf(new_state_file,"%s.new",m_state_file.c_str());
+ formatstr(new_state_file,"%s.new",m_state_file.c_str());
FILE *fp;
if( !(fp = safe_fopen_wrapper_follow(new_state_file.c_str(), "w")) ) {
EXCEPT("failed to save state to %s\n",new_state_file.c_str());
@@ -616,7 +616,7 @@ void Defrag::poll()
ClassAdList startdAds;
std::string requirements;
- sprintf(requirements,"(%s) && Draining =!= true",m_defrag_requirements.c_str());
+ formatstr(requirements,"(%s) && Draining =!= true",m_defrag_requirements.c_str());
if( !queryMachines(requirements.c_str(),"DEFRAG_REQUIREMENTS",startdAds) ) {
dprintf(D_ALWAYS,"Doing nothing, because the query to select machines matching DEFRAG_REQUIREMENTS failed.\n");
return;
@@ -708,7 +708,7 @@ Defrag::drain(const ClassAd &startd_ad)
if( m_draining_schedule <= DRAIN_GRACEFUL ) {
dprintf(D_ALWAYS,"Expected draining completion time is %ds; expected draining badput is %d cpu-seconds\n",
(int)(graceful_completion-now),graceful_badput);
- sprintf(draining_check_expr,"%s <= %d && %s <= %d",
+ formatstr(draining_check_expr,"%s <= %d && %s <= %d",
ATTR_EXPECTED_MACHINE_GRACEFUL_DRAINING_COMPLETION,
graceful_completion + negligible_deadline_slippage,
ATTR_EXPECTED_MACHINE_GRACEFUL_DRAINING_BADPUT,
@@ -717,7 +717,7 @@ Defrag::drain(const ClassAd &startd_ad)
else { // DRAIN_FAST and DRAIN_QUICK are effectively equivalent here
dprintf(D_ALWAYS,"Expected draining completion time is %ds; expected draining badput is %d cpu-seconds\n",
(int)(quick_completion-now),quick_badput);
- sprintf(draining_check_expr,"%s <= %d && %s <= %d",
+ formatstr(draining_check_expr,"%s <= %d && %s <= %d",
ATTR_EXPECTED_MACHINE_QUICK_DRAINING_COMPLETION,
quick_completion + negligible_deadline_slippage,
ATTR_EXPECTED_MACHINE_QUICK_DRAINING_BADPUT,
@@ -790,7 +790,7 @@ Defrag::invalidatePublicAd() {
invalidate_ad.SetMyTypeName(QUERY_ADTYPE);
invalidate_ad.SetTargetTypeName("Defrag");
- sprintf(line,"%s == \"%s\"", ATTR_NAME, m_daemon_name.c_str());
+ formatstr(line,"%s == \"%s\"", ATTR_NAME, m_daemon_name.c_str());
invalidate_ad.AssignExpr(ATTR_REQUIREMENTS, line.c_str());
invalidate_ad.Assign(ATTR_NAME, m_daemon_name.c_str());
daemonCore->sendUpdates(INVALIDATE_ADS_GENERIC, &invalidate_ad, NULL, false);
diff --git a/src/ec2_gahp/amazongahp_common.cpp b/src/ec2_gahp/amazongahp_common.cpp
index 25d5810..29bdce7 100644
--- a/src/ec2_gahp/amazongahp_common.cpp
+++ b/src/ec2_gahp/amazongahp_common.cpp
@@ -331,14 +331,14 @@ bool check_access_and_secret_key_file(const char* accesskeyfile, const char* sec
{
// check the accesskeyfile
if( !check_read_access_file(accesskeyfile) ) {
- sprintf(err_msg, "Cannot_read_access_key_file(%s)", accesskeyfile? accesskeyfile:"");
+ formatstr(err_msg, "Cannot_read_access_key_file(%s)", accesskeyfile? accesskeyfile:"");
dprintf (D_ALWAYS, "Error: %s\n", err_msg.c_str());
return false;
}
// check the accesskeyfile and secretkeyfile
if( !check_read_access_file(secretkeyfile) ) {
- sprintf(err_msg, "Cannot_read_secret_key_file(%s)", secretkeyfile? secretkeyfile:"");
+ formatstr(err_msg, "Cannot_read_secret_key_file(%s)", secretkeyfile? secretkeyfile:"");
dprintf (D_ALWAYS, "Error: %s\n", err_msg.c_str());
return false;
}
@@ -364,7 +364,7 @@ create_output_string (int req_id, const char ** results, const int argc)
{
std::string buffer;
- sprintf( buffer, "%d", req_id );
+ formatstr( buffer, "%d", req_id );
for ( int i = 0; i < argc; i++ ) {
buffer += ' ';
--
1.7.7.6
>From 9bd29f33828913df934c5e9422465251b2ebfed8 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Fri, 3 Aug 2012 11:31:53 +0200
Subject: [PATCH 6/9] Remove global sprintf overloads
---
src/condor_utils/stl_string_utils.cpp | 19 -------------------
src/condor_utils/stl_string_utils.h | 4 +---
2 files changed, 1 insertions(+), 22 deletions(-)
diff --git a/src/condor_utils/stl_string_utils.cpp b/src/condor_utils/stl_string_utils.cpp
index 53dd16a..1eb88ea 100644
--- a/src/condor_utils/stl_string_utils.cpp
+++ b/src/condor_utils/stl_string_utils.cpp
@@ -121,25 +121,6 @@ int formatstr(MyString& s, const char* format, ...) {
return r;
}
-int sprintf(std::string& s, const char* format, ...) {
- va_list args;
- va_start(args, format);
- int r = vformatstr(s, format, args);
- va_end(args);
- return r;
-}
-
-int sprintf(MyString& s, const char* format, ...) {
- va_list args;
- std::string t;
- va_start(args, format);
- // this gets me the sprintf-standard return value (# chars printed)
- int r = vformatstr(t, format, args);
- va_end(args);
- assign(s, t);
- return r;
-}
-
int sprintf_cat(std::string& s, const char* format, ...) {
va_list args;
std::string t;
diff --git a/src/condor_utils/stl_string_utils.h b/src/condor_utils/stl_string_utils.h
index c85bac1..cf854a7 100644
--- a/src/condor_utils/stl_string_utils.h
+++ b/src/condor_utils/stl_string_utils.h
@@ -26,7 +26,7 @@
#include "condor_header_features.h"
#include "MyString.h"
-// sprintf() will try to write to a fixed buffer first, for reasons of
+// formatstr() will try to write to a fixed buffer first, for reasons of
// efficiency. This is the size of that buffer.
#define STL_STRING_UTILS_FIXBUF 500
@@ -34,8 +34,6 @@
// memory/buffer safe.
int formatstr(std::string& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
int formatstr(MyString& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
-int sprintf(std::string& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
-int sprintf(MyString& s, const char* format, ...) CHECK_PRINTF_FORMAT(2,3);
// Appending versions of above.
// These return number of new chars appended.
--
1.7.7.6
>From ea0b9bd44bf0414786dcf5f6e9aa70d8eecc7c2e Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Fri, 3 Aug 2012 14:57:52 +0200
Subject: [PATCH 7/9] Introduce MyString::formatstr and MyString::vformatstr
---
src/condor_utils/MyString.cpp | 21 +++++++++++++++++++++
src/condor_utils/MyString.h | 2 ++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/condor_utils/MyString.cpp b/src/condor_utils/MyString.cpp
index 0c326a9..1c163f0 100644
--- a/src/condor_utils/MyString.cpp
+++ b/src/condor_utils/MyString.cpp
@@ -597,6 +597,27 @@ MyString::sprintf_cat(const char *format,...)
}
bool
+MyString::vformatstr(const char *format,va_list args)
+{
+ Len = 0;
+ if(Data) Data[0] = '\0';
+ return vsprintf_cat(format,args);
+}
+
+bool
+MyString::formatstr(const char *format,...)
+{
+ bool succeeded;
+ va_list args;
+
+ va_start(args, format);
+ succeeded = vsprintf(format,args);
+ va_end(args);
+
+ return succeeded;
+}
+
+bool
MyString::vsprintf(const char *format,va_list args)
{
Len = 0;
diff --git a/src/condor_utils/MyString.h b/src/condor_utils/MyString.h
index 374570e..b306284 100644
--- a/src/condor_utils/MyString.h
+++ b/src/condor_utils/MyString.h
@@ -240,12 +240,14 @@ class MyString
* Assuming, of course, that you don't run out of memory.
* The returns true if it succeeded, false otherwise.
*/
+ bool formatstr(const char *format, ...) CHECK_PRINTF_FORMAT(2,3);
bool sprintf(const char *format, ...) CHECK_PRINTF_FORMAT(2,3);
/** Fills a MyString with what you would have gotten from vsprintf.
* This is handy if you define your own printf-like functions.
*/
+ bool vformatstr(const char *format, va_list args);
bool vsprintf(const char *format, va_list args);
/** Like sprintf, but this appends to existing data. */
--
1.7.7.6
>From 685d71bd6b2aa1faffdbbbec289d4d325cddf2e5 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Fri, 3 Aug 2012 15:03:26 +0200
Subject: [PATCH 8/9] Replace calls to MyString::[v]sprintf() with
MyString::[v]formatstr()
---
src/ccb/ccb_client.cpp | 14 +-
src/ccb/ccb_listener.cpp | 4 +-
src/ccb/ccb_server.cpp | 10 +-
src/condor_chirp/condor_chirp.cpp | 2 +-
src/condor_collector.V6/collector.cpp | 8 +-
src/condor_collector.V6/collector_engine.cpp | 2 +-
src/condor_collector.V6/collector_stats.cpp | 6 +-
src/condor_collector.V6/view_server.cpp | 4 +-
.../aviary/src/AviaryScheddPlugin.cpp | 6 +-
src/condor_contrib/aviary/src/HistoryFile.cpp | 2 +-
.../aviary/src/HistoryProcessingUtils.cpp | 2 +-
.../aviary/src/JobServerJobLogConsumer.cpp | 2 +-
src/condor_contrib/aviary/src/SchedulerObject.cpp | 2 +-
.../mgmt/qmf/daemons/HistoryFile.cpp | 2 +-
.../mgmt/qmf/daemons/HistoryProcessingUtils.cpp | 2 +-
.../mgmt/qmf/daemons/JobServerJobLogConsumer.cpp | 2 +-
.../mgmt/qmf/plugins/MgmtCollectorPlugin.cpp | 2 +-
.../mgmt/qmf/plugins/MgmtScheddPlugin.cpp | 6 +-
.../mgmt/qmf/plugins/NegotiatorObject.cpp | 4 +-
.../mgmt/qmf/plugins/SchedulerObject.cpp | 2 +-
.../mgmt/qmf/plugins/SubmissionObject.cpp | 2 +-
src/condor_contrib/triggerd/src/Triggerd.cpp | 2 +-
src/condor_daemon_client/dc_schedd.cpp | 6 +-
src/condor_daemon_client/dc_starter.cpp | 14 +-
src/condor_daemon_core.V6/HookClient.cpp | 2 +-
src/condor_daemon_core.V6/HookClientMgr.cpp | 2 +-
src/condor_daemon_core.V6/daemon_command.cpp | 4 +-
src/condor_daemon_core.V6/daemon_core.cpp | 16 +-
src/condor_daemon_core.V6/daemon_core_main.cpp | 8 +-
src/condor_daemon_core.V6/self_draining_queue.cpp | 2 +-
src/condor_daemon_core.V6/self_monitor.cpp | 4 +-
src/condor_daemon_core.V6/timer_manager.cpp | 2 +-
src/condor_dagman/dag.cpp | 20 +-
src/condor_dagman/dagman_commands.cpp | 6 +-
src/condor_dagman/dagman_main.cpp | 8 +-
src/condor_dagman/debug.cpp | 10 +-
src/condor_dagman/job.cpp | 6 +-
src/condor_dagman/jobstate_log.cpp | 18 +-
src/condor_dagman/parse.cpp | 4 +-
src/condor_gridmanager/dcloudjob.cpp | 8 +-
src/condor_gridmanager/dcloudresource.cpp | 4 +-
src/condor_gridmanager/gahp-client.cpp | 14 +-
src/condor_had/DownloadReplicaTransferer.cpp | 2 +-
src/condor_had/ReplicatorStateMachine.cpp | 4 +-
src/condor_had/StateMachine.cpp | 4 +-
src/condor_had/Utils.cpp | 8 +-
src/condor_io/condor_auth_claim.cpp | 2 +-
src/condor_io/condor_auth_passwd.cpp | 4 +-
src/condor_io/condor_ipverify.cpp | 32 +-
src/condor_io/condor_secman.cpp | 22 +-
src/condor_io/shared_port_client.cpp | 2 +-
src/condor_io/shared_port_endpoint.cpp | 10 +-
src/condor_io/shared_port_server.cpp | 2 +-
src/condor_job_router/JobRouter.cpp | 4 +-
src/condor_job_router/JobRouterHookMgr.cpp | 2 +-
src/condor_job_router/submit_job.cpp | 30 +-
src/condor_master.V6/master.cpp | 4 +-
src/condor_master.V6/masterDaemon.cpp | 16 +-
src/condor_negotiator.V6/Accountant.cpp | 8 +-
src/condor_negotiator.V6/matchmaker.cpp | 62 ++--
src/condor_privsep/privsep_client.UNIX.cpp | 2 +-
src/condor_q.V6/queue.cpp | 6 +-
src/condor_rm.V6/rm.cpp | 4 +-
src/condor_schedd.V6/dedicated_scheduler.cpp | 6 +-
src/condor_schedd.V6/grid_universe.cpp | 10 +-
src/condor_schedd.V6/qmgmt.cpp | 28 +-
src/condor_schedd.V6/qmgr_job_updater.cpp | 2 +-
src/condor_schedd.V6/schedd.cpp | 82 ++--
src/condor_schedd.V6/schedd_files.cpp | 24 +-
src/condor_schedd.V6/schedd_main.cpp | 4 +-
src/condor_schedd.V6/schedd_stats.cpp | 2 +-
src/condor_schedd.V6/schedd_td.cpp | 2 +-
src/condor_schedd.V6/transfer_queue.cpp | 2 +-
src/condor_shadow.V6.1/NTreceivers.cpp | 2 +-
src/condor_shadow.V6.1/baseshadow.cpp | 24 +-
src/condor_shadow.V6.1/mpiresource.cpp | 2 +-
src/condor_shadow.V6.1/mpishadow.cpp | 6 +-
src/condor_shadow.V6.1/pseudo_ops.cpp | 6 +-
src/condor_shadow.V6.1/remoteresource.cpp | 6 +-
src/condor_startd.V6/AvailStats.cpp | 2 +-
src/condor_startd.V6/Reqexp.cpp | 18 +-
src/condor_startd.V6/ResMgr.cpp | 12 +-
src/condor_startd.V6/Resource.cpp | 18 +-
src/condor_startd.V6/StartdHookMgr.cpp | 4 +-
src/condor_startd.V6/Starter.cpp | 2 +-
src/condor_startd.V6/claim.cpp | 46 +-
src/condor_startd.V6/cod_mgr.cpp | 2 +-
src/condor_startd.V6/command.cpp | 2 +-
src/condor_startd.V6/startd_cron_job_params.cpp | 2 +-
src/condor_startd.V6/util.cpp | 8 +-
src/condor_startd.V6/vmuniverse_mgr.cpp | 8 +-
src/condor_starter.V6.1/NTsenders.cpp | 2 +-
src/condor_starter.V6.1/StarterHookMgr.cpp | 8 +-
src/condor_starter.V6.1/baseStarter.cpp | 46 +-
.../glexec_privsep_helper.linux.cpp | 12 +-
src/condor_starter.V6.1/java_proc.cpp | 6 +-
src/condor_starter.V6.1/jic_local.cpp | 2 +-
src/condor_starter.V6.1/jic_shadow.cpp | 4 +-
src/condor_starter.V6.1/job_info_communicator.cpp | 2 +-
src/condor_starter.V6.1/local_user_log.cpp | 4 +-
src/condor_starter.V6.1/os_proc.cpp | 34 +-
src/condor_starter.V6.1/tool_daemon_proc.cpp | 6 +-
src/condor_starter.V6.1/user_proc.cpp | 6 +-
src/condor_starter.V6.1/vm_gahp_request.cpp | 4 +-
src/condor_starter.V6.1/vm_gahp_server.cpp | 20 +-
src/condor_starter.V6.1/vm_proc.cpp | 8 +-
src/condor_status.V6/status.cpp | 2 +-
src/condor_submit.V6/submit.cpp | 490 ++++++++++----------
src/condor_tools/advertise.cpp | 2 +-
src/condor_tools/condor_test_match.cpp | 2 +-
src/condor_tools/preen.cpp | 18 +-
src/condor_tools/qedit.cpp | 4 +-
src/condor_tools/ssh_to_job.cpp | 12 +-
src/condor_tools/store_cred_main.cpp | 4 +-
src/condor_tools/transfer_data.cpp | 6 +-
src/condor_tools/user_prio.cpp | 4 +-
src/condor_transferd/td_maint.cpp | 4 +-
src/condor_transferd/td_read_files.cpp | 4 +-
src/condor_transferd/td_write_files.cpp | 4 +-
src/condor_utils/ClassAdReevaluator.cpp | 2 +-
src/condor_utils/KeyCache.cpp | 2 +-
src/condor_utils/MyString.cpp | 4 +-
src/condor_utils/ad_printmask.cpp | 22 +-
src/condor_utils/classadHistory.cpp | 4 +-
src/condor_utils/classad_cron_job.cpp | 2 +-
src/condor_utils/classad_hashtable.cpp | 2 +-
src/condor_utils/classad_log.cpp | 6 +-
src/condor_utils/classad_visa.cpp | 4 +-
src/condor_utils/compat_classad.cpp | 2 +-
src/condor_utils/condor_arglist.cpp | 10 +-
src/condor_utils/condor_claimid_parser.h | 10 +-
src/condor_utils/condor_config.cpp | 46 +-
src/condor_utils/condor_event.cpp | 22 +-
src/condor_utils/condor_new_classads.cpp | 2 +-
src/condor_utils/condor_sockaddr.cpp | 4 +-
src/condor_utils/condor_user_policy.cpp | 4 +-
src/condor_utils/condor_xml_classads.cpp | 4 +-
src/condor_utils/domain_tools.cpp | 2 +-
src/condor_utils/email_cpp.cpp | 2 +-
src/condor_utils/env.cpp | 8 +-
src/condor_utils/file_sql.cpp | 10 +-
src/condor_utils/file_transfer.cpp | 62 ++--
src/condor_utils/generic_stats.cpp | 34 +-
src/condor_utils/generic_stats.h | 4 +-
src/condor_utils/hashkey.cpp | 8 +-
src/condor_utils/hibernator.tools.cpp | 4 +-
src/condor_utils/internet.cpp | 4 +-
src/condor_utils/open_files_in_pid.cpp | 2 +-
src/condor_utils/proc_family_proxy.cpp | 2 +-
src/condor_utils/proc_id.cpp | 2 +-
src/condor_utils/read_multiple_logs.cpp | 12 +-
src/condor_utils/read_user_log_state.cpp | 6 +-
src/condor_utils/socket_proxy.cpp | 2 +-
src/condor_utils/user_job_policy.cpp | 12 +-
src/condor_utils/user_log_header.cpp | 2 +-
src/condor_utils/write_user_log.cpp | 8 +-
src/condor_vm-gahp/vm_type.cpp | 8 +-
src/condor_vm-gahp/vmgahp_common.cpp | 2 +-
src/condor_vm-gahp/vmware_type.cpp | 44 +-
src/condor_vm-gahp/xen_type.linux.cpp | 10 +-
src/condor_who/who.cpp | 2 +-
161 files changed, 966 insertions(+), 966 deletions(-)
diff --git a/src/ccb/ccb_client.cpp b/src/ccb/ccb_client.cpp
index 0b18884..19e431a 100644
--- a/src/ccb/ccb_client.cpp
+++ b/src/ccb/ccb_client.cpp
@@ -127,11 +127,11 @@ CCBClient::ReverseConnect_blocking( CondorError *error )
shared_listener->InitAndReconfig();
MyString errmsg;
if( !shared_listener->CreateListener() ) {
- errmsg.sprintf("Failed to create shared port endpoint for reversed connection from %s.",
+ errmsg.formatstr("Failed to create shared port endpoint for reversed connection from %s.",
m_target_peer_description.Value());
}
else if( !(listener_addr = shared_listener->GetMyRemoteAddress()) ) {
- errmsg.sprintf("Failed to get remote address for shared port endpoint for reversed connection from %s.",
+ errmsg.formatstr("Failed to get remote address for shared port endpoint for reversed connection from %s.",
m_target_peer_description.Value());
}
if( !listener_addr ) {
@@ -147,7 +147,7 @@ CCBClient::ReverseConnect_blocking( CondorError *error )
listen_sock->bind(false,0);
if( !listen_sock->listen() ) {
MyString errmsg;
- errmsg.sprintf("Failed to listen for reversed connection from %s.",
+ errmsg.formatstr("Failed to listen for reversed connection from %s.",
m_target_peer_description.Value());
if( error ) {
error->push("CCBClient", CEDAR_ERR_CONNECT_FAILED,errmsg.Value());
@@ -252,7 +252,7 @@ CCBClient::ReverseConnect_blocking( CondorError *error )
if( timed_out ) {
MyString errmsg;
- errmsg.sprintf(
+ errmsg.formatstr(
"Timed out waiting for response after requesting reversed "
"connection from %s ccbid %s via CCB server %s.",
m_target_peer_description.Value(),
@@ -320,7 +320,7 @@ bool CCBClient::SplitCCBContact( char const *ccb_contact, MyString &ccb_address,
char const *ptr = strchr(ccb_contact,'#');
if( !ptr ) {
MyString errmsg;
- errmsg.sprintf("Bad CCB contact '%s' when connecting to %s.",
+ errmsg.formatstr("Bad CCB contact '%s' when connecting to %s.",
ccb_contact, m_target_peer_description.Value());
if( error ) {
@@ -418,7 +418,7 @@ CCBClient::HandleReversedConnectionRequestReply(CondorError *error)
m_ccb_sock->decode();
if( !msg.initFromStream(*m_ccb_sock) || !m_ccb_sock->end_of_message() ) {
- errmsg.sprintf("Failed to read response from CCB server "
+ errmsg.formatstr("Failed to read response from CCB server "
"%s when requesting reversed connection to %s",
m_ccb_sock->peer_description(),
m_target_peer_description.Value());
@@ -436,7 +436,7 @@ CCBClient::HandleReversedConnectionRequestReply(CondorError *error)
MyString remote_errmsg;
msg.LookupString(ATTR_ERROR_STRING,remote_errmsg);
- errmsg.sprintf(
+ errmsg.formatstr(
"received failure message from CCB server %s in response to "
"request for reversed connection to %s: %s",
m_ccb_sock->peer_description(),
diff --git a/src/ccb/ccb_listener.cpp b/src/ccb/ccb_listener.cpp
index 2fdbb32..a16513f 100644
--- a/src/ccb/ccb_listener.cpp
+++ b/src/ccb/ccb_listener.cpp
@@ -91,7 +91,7 @@ CCBListener::RegisterWithCCBServer(bool blocking)
// for debugging purposes only, identify ourselves to the CCB server
MyString name;
- name.sprintf("%s %s",get_mySubSystem()->getName(),daemonCore->publicNetworkIpAddr());
+ name.formatstr("%s %s",get_mySubSystem()->getName(),daemonCore->publicNetworkIpAddr());
msg.Assign( ATTR_NAME, name.Value() );
bool success = SendMsgToCCB(msg,blocking);
@@ -461,7 +461,7 @@ CCBListener::DoReversedCCBConnect( char const *address, char const *connect_id,
char const *peer_ip = sock->peer_ip_str();
if( peer_ip && !strstr(peer_description,peer_ip)) {
MyString desc;
- desc.sprintf("%s at %s",peer_description,sock->get_sinful_peer());
+ desc.formatstr("%s at %s",peer_description,sock->get_sinful_peer());
sock->set_peer_description(desc.Value());
}
else {
diff --git a/src/ccb/ccb_server.cpp b/src/ccb/ccb_server.cpp
index 16aac91..d2a97d4 100644
--- a/src/ccb/ccb_server.cpp
+++ b/src/ccb/ccb_server.cpp
@@ -42,7 +42,7 @@ CCBIDFromString(CCBID &ccbid,char const *ccbid_str)
static char const *
CCBIDToString(CCBID ccbid,MyString &ccbid_str)
{
- ccbid_str.sprintf("%lu",ccbid);
+ ccbid_str.formatstr("%lu",ccbid);
return ccbid_str.Value();
}
@@ -60,7 +60,7 @@ CCBIDFromContactString(CCBID &ccbid,char const *ccb_contact)
static void
CCBIDToContactString(char const *my_address,CCBID ccbid,MyString &ccb_contact)
{
- ccb_contact.sprintf("%s#%lu",my_address,ccbid);
+ ccb_contact.formatstr("%s#%lu",my_address,ccbid);
}
CCBServer::CCBServer():
@@ -135,7 +135,7 @@ CCBServer::InitAndReconfig()
sinful.setPrivateAddr(NULL);
sinful.setCCBContact(NULL);
ASSERT( sinful.getSinful() && sinful.getSinful()[0] == '<' );
- m_address.sprintf("%s",sinful.getSinful()+1);
+ m_address.formatstr("%s",sinful.getSinful()+1);
if( m_address[m_address.Length()-1] == '>' ) {
m_address.setChar(m_address.Length()-1,'\0');
}
@@ -163,7 +163,7 @@ CCBServer::InitAndReconfig()
char *spool = param("SPOOL");
ASSERT( spool );
Sinful my_addr( daemonCore->publicNetworkIpAddr() );
- m_reconnect_fname.sprintf("%s%c%s-%s.ccb_reconnect",
+ m_reconnect_fname.formatstr("%s%c%s-%s.ccb_reconnect",
spool,
DIR_DELIM_CHAR,
my_addr.getHost() ? my_addr.getHost() : "localhost",
@@ -386,7 +386,7 @@ CCBServer::HandleRequest(int cmd,Stream *stream)
sock->peer_description(), target_ccbid_str.Value());
MyString error_msg;
- error_msg.sprintf(
+ error_msg.formatstr(
"CCB server rejecting request for ccbid %s because no daemon is "
"currently registered with that id "
"(perhaps it recently disconnected).", target_ccbid_str.Value());
diff --git a/src/condor_chirp/condor_chirp.cpp b/src/condor_chirp/condor_chirp.cpp
index d804476..78bc89e 100644
--- a/src/condor_chirp/condor_chirp.cpp
+++ b/src/condor_chirp/condor_chirp.cpp
@@ -96,7 +96,7 @@ chirp_client_connect_starter()
if (NULL == (dir = getenv("_CONDOR_SCRATCH_DIR"))) {
dir = ".";
}
- path.sprintf( "%s%c%s",dir,DIR_DELIM_CHAR,"chirp.config");
+ path.formatstr( "%s%c%s",dir,DIR_DELIM_CHAR,"chirp.config");
file = safe_fopen_wrapper_follow(path.Value(),"r");
if(!file) {
fprintf(stderr, "Can't open %s file\n",path.Value());
diff --git a/src/condor_collector.V6/collector.cpp b/src/condor_collector.V6/collector.cpp
index cfc0023..6ec2664 100644
--- a/src/condor_collector.V6/collector.cpp
+++ b/src/condor_collector.V6/collector.cpp
@@ -988,7 +988,7 @@ void CollectorDaemon::process_query_public (AdTypes whichAds,
checks_absent = machine_refs.contains_anycase( ATTR_ABSENT );
if (!checks_absent) {
MyString modified_filter;
- modified_filter.sprintf("(%s) && (%s =!= True)",
+ modified_filter.formatstr("(%s) && (%s =!= True)",
ExprTreeToString(__filter__),ATTR_ABSENT);
query->AssignExpr(ATTR_REQUIREMENTS,modified_filter.Value());
__filter__ = query->LookupExpr(ATTR_REQUIREMENTS);
@@ -1521,12 +1521,12 @@ void CollectorDaemon::init_classad(int interval)
MyString id;
if( CollectorName ) {
if( strchr( CollectorName, '@' ) ) {
- id.sprintf( "%s", CollectorName );
+ id.formatstr( "%s", CollectorName );
} else {
- id.sprintf( "%s@%s", CollectorName, get_local_fqdn().Value() );
+ id.formatstr( "%s@%s", CollectorName, get_local_fqdn().Value() );
}
} else {
- id.sprintf( "%s", get_local_fqdn().Value() );
+ id.formatstr( "%s", get_local_fqdn().Value() );
}
ad->Assign( ATTR_NAME, id.Value() );
diff --git a/src/condor_collector.V6/collector_engine.cpp b/src/condor_collector.V6/collector_engine.cpp
index 91d59cd..d2108a8 100644
--- a/src/condor_collector.V6/collector_engine.cpp
+++ b/src/condor_collector.V6/collector_engine.cpp
@@ -962,7 +962,7 @@ updateClassAd (CollectorHashTable &hashTable,
{
EXCEPT ("Error reading system time!");
}
- buf.sprintf( "%s = %d", ATTR_LAST_HEARD_FROM, (int)now);
+ buf.formatstr( "%s = %d", ATTR_LAST_HEARD_FROM, (int)now);
ad->Insert ( buf.Value() );
}
diff --git a/src/condor_collector.V6/collector_stats.cpp b/src/condor_collector.V6/collector_stats.cpp
index be6afe4..fa4586d 100644
--- a/src/condor_collector.V6/collector_stats.cpp
+++ b/src/condor_collector.V6/collector_stats.cpp
@@ -618,7 +618,7 @@ CollectorDaemonStatsList::enable( bool nable )
void
StatsHashKey::getstr( MyString &buf )
{
- buf.sprintf( "'%s':'%s':'%s'",
+ buf.formatstr( "'%s':'%s':'%s'",
type.Value(), name.Value(), ip_addr.Value() );
}
@@ -649,11 +649,11 @@ CollectorDaemonStatsList::hashKey (StatsHashKey &key,
// If there is a slot ID, append it to Machine
int slot;
if (ad->LookupInteger( ATTR_SLOT_ID, slot)) {
- slot_buf.sprintf(":%d", slot);
+ slot_buf.formatstr(":%d", slot);
}
else if (param_boolean("ALLOW_VM_CRUFT", false) &&
ad->LookupInteger(ATTR_VIRTUAL_MACHINE_ID, slot)) {
- slot_buf.sprintf(":%d", slot);
+ slot_buf.formatstr(":%d", slot);
}
}
key.name = buf;
diff --git a/src/condor_collector.V6/view_server.cpp b/src/condor_collector.V6/view_server.cpp
index cfcd903..9aeae18 100644
--- a/src/condor_collector.V6/view_server.cpp
+++ b/src/condor_collector.V6/view_server.cpp
@@ -184,9 +184,9 @@ void ViewServer::Config()
for (int j=0; j<HistoryLevels; j++) {
DataSet[i][j].MaxSamples=4*((int) pow((double)4,(double)j));
DataSet[i][j].NumSamples=0;
- DataSet[i][j].OldFileName.sprintf("%s/viewhist%d.%d.old",history_dir,i,j);
+ DataSet[i][j].OldFileName.formatstr("%s/viewhist%d.%d.old",history_dir,i,j);
DataSet[i][j].OldStartTime=FindFileStartTime(DataSet[i][j].OldFileName.Value());
- DataSet[i][j].NewFileName.sprintf("%s/viewhist%d.%d.new",history_dir,i,j);
+ DataSet[i][j].NewFileName.formatstr("%s/viewhist%d.%d.new",history_dir,i,j);
DataSet[i][j].NewStartTime=FindFileStartTime(DataSet[i][j].NewFileName.Value());
}
}
diff --git a/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp b/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp
index d41000a..096e52b 100644
--- a/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp
+++ b/src/condor_contrib/aviary/src/AviaryScheddPlugin.cpp
@@ -114,7 +114,7 @@ AviaryScheddPlugin::initialize()
EXCEPT("%s on job is missing or not an integer", ATTR_JOB_STATUS);
}
- key.sprintf("%d.%d", id.cluster, id.proc);
+ key.formatstr("%d.%d", id.cluster, id.proc);
processJob(key.Value(), ATTR_JOB_STATUS, value);
@@ -313,10 +313,10 @@ AviaryScheddPlugin::processJob(const char *key,
// wrong if the DAGMan job didn't use the
// default, but it is better to be wrong than
// to fail entirely, which is the alternative.
- submissionName.sprintf("%s#%d", Name, dagman.cluster);
+ submissionName.formatstr("%s#%d", Name, dagman.cluster);
}
} else {
- submissionName.sprintf("%s#%d", Name, id.cluster);
+ submissionName.formatstr("%s#%d", Name, id.cluster);
}
MyString tmp;
diff --git a/src/condor_contrib/aviary/src/HistoryFile.cpp b/src/condor_contrib/aviary/src/HistoryFile.cpp
index 13f6d0b..1e746c8 100644
--- a/src/condor_contrib/aviary/src/HistoryFile.cpp
+++ b/src/condor_contrib/aviary/src/HistoryFile.cpp
@@ -124,7 +124,7 @@ HistoryFile::init(CondorError &errstack)
ASSERT(buf);
long unsigned int id;
ASSERT(getId(id));
- tmp.sprintf("%s%shistory.%ld%s", dirname(buf), DIR_DELIM_STRING, id, HISTORY_INDEX_SUFFIX);
+ tmp.formatstr("%s%shistory.%ld%s", dirname(buf), DIR_DELIM_STRING, id, HISTORY_INDEX_SUFFIX);
m_index_name = tmp.Value();
free(buf);
diff --git a/src/condor_contrib/aviary/src/HistoryProcessingUtils.cpp b/src/condor_contrib/aviary/src/HistoryProcessingUtils.cpp
index 5a474e3..d29198a 100644
--- a/src/condor_contrib/aviary/src/HistoryProcessingUtils.cpp
+++ b/src/condor_contrib/aviary/src/HistoryProcessingUtils.cpp
@@ -68,7 +68,7 @@ process ( const HistoryEntry &entry )
{
MyString key;
- key.sprintf ( "%d.%d", entry.cluster, entry.proc );
+ key.formatstr ( "%d.%d", entry.cluster, entry.proc );
const char* key_cstr = key.StrDup();
diff --git a/src/condor_contrib/aviary/src/JobServerJobLogConsumer.cpp b/src/condor_contrib/aviary/src/JobServerJobLogConsumer.cpp
index ad7e5de..f12c610 100644
--- a/src/condor_contrib/aviary/src/JobServerJobLogConsumer.cpp
+++ b/src/condor_contrib/aviary/src/JobServerJobLogConsumer.cpp
@@ -95,7 +95,7 @@ JobServerJobLogConsumer::NewClassAd(const char *_key,
PROC_ID proc = getProcByString(_key);
MyString cluster_key;
- cluster_key.sprintf("0%d.-1", proc.cluster);
+ cluster_key.formatstr("0%d.-1", proc.cluster);
const char *cluster_dup = cluster_key.StrDup();
JobCollectionType::const_iterator element = g_jobs.find(cluster_dup);
diff --git a/src/condor_contrib/aviary/src/SchedulerObject.cpp b/src/condor_contrib/aviary/src/SchedulerObject.cpp
index 88cceb0..5561fe0 100644
--- a/src/condor_contrib/aviary/src/SchedulerObject.cpp
+++ b/src/condor_contrib/aviary/src/SchedulerObject.cpp
@@ -250,7 +250,7 @@ SchedulerObject::submit(AttributeMapType &jobAdMap, std::string &id, std::string
//tmp.sprintf("%s#%d.%d", Name, cluster, proc);
// we have other API compositions for job id and submission id
// so let's return raw cluster.proc
- tmp.sprintf("%d.%d", cluster, proc);
+ tmp.formatstr("%d.%d", cluster, proc);
id = tmp.Value();
return true;
diff --git a/src/condor_contrib/mgmt/qmf/daemons/HistoryFile.cpp b/src/condor_contrib/mgmt/qmf/daemons/HistoryFile.cpp
index 13f6d0b..1e746c8 100644
--- a/src/condor_contrib/mgmt/qmf/daemons/HistoryFile.cpp
+++ b/src/condor_contrib/mgmt/qmf/daemons/HistoryFile.cpp
@@ -124,7 +124,7 @@ HistoryFile::init(CondorError &errstack)
ASSERT(buf);
long unsigned int id;
ASSERT(getId(id));
- tmp.sprintf("%s%shistory.%ld%s", dirname(buf), DIR_DELIM_STRING, id, HISTORY_INDEX_SUFFIX);
+ tmp.formatstr("%s%shistory.%ld%s", dirname(buf), DIR_DELIM_STRING, id, HISTORY_INDEX_SUFFIX);
m_index_name = tmp.Value();
free(buf);
diff --git a/src/condor_contrib/mgmt/qmf/daemons/HistoryProcessingUtils.cpp b/src/condor_contrib/mgmt/qmf/daemons/HistoryProcessingUtils.cpp
index e7acc61..f81d64e 100644
--- a/src/condor_contrib/mgmt/qmf/daemons/HistoryProcessingUtils.cpp
+++ b/src/condor_contrib/mgmt/qmf/daemons/HistoryProcessingUtils.cpp
@@ -76,7 +76,7 @@ process ( const HistoryEntry &entry )
{
MyString key;
- key.sprintf ( "%d.%d", entry.cluster, entry.proc );
+ key.formatstr ( "%d.%d", entry.cluster, entry.proc );
const char* key_cstr = key.StrDup();
diff --git a/src/condor_contrib/mgmt/qmf/daemons/JobServerJobLogConsumer.cpp b/src/condor_contrib/mgmt/qmf/daemons/JobServerJobLogConsumer.cpp
index 3e6ac64..4cfa5dd 100644
--- a/src/condor_contrib/mgmt/qmf/daemons/JobServerJobLogConsumer.cpp
+++ b/src/condor_contrib/mgmt/qmf/daemons/JobServerJobLogConsumer.cpp
@@ -92,7 +92,7 @@ JobServerJobLogConsumer::NewClassAd(const char *_key,
PROC_ID proc = getProcByString(_key);
MyString cluster_key;
- cluster_key.sprintf("0%d.-1", proc.cluster);
+ cluster_key.formatstr("0%d.-1", proc.cluster);
const char *cluster_dup = cluster_key.StrDup();
JobCollectionType::const_iterator element = g_jobs.find(cluster_dup);
diff --git a/src/condor_contrib/mgmt/qmf/plugins/MgmtCollectorPlugin.cpp b/src/condor_contrib/mgmt/qmf/plugins/MgmtCollectorPlugin.cpp
index c4c5331..a0a8ee8 100644
--- a/src/condor_contrib/mgmt/qmf/plugins/MgmtCollectorPlugin.cpp
+++ b/src/condor_contrib/mgmt/qmf/plugins/MgmtCollectorPlugin.cpp
@@ -248,7 +248,7 @@ struct MgmtCollectorPlugin : public Service, CollectorPlugin
if (!ad.LookupString(ATTR_NAME, name)) {
name = "UNKNOWN";
}
- name.sprintf("Negotiator: %s", hashKey.name.Value());
+ name.formatstr("Negotiator: %s", hashKey.name.Value());
negotiatorObject =
new NegotiatorObject(singleton->getInstance(),
diff --git a/src/condor_contrib/mgmt/qmf/plugins/MgmtScheddPlugin.cpp b/src/condor_contrib/mgmt/qmf/plugins/MgmtScheddPlugin.cpp
index 2b1de5e..eeb781d 100644
--- a/src/condor_contrib/mgmt/qmf/plugins/MgmtScheddPlugin.cpp
+++ b/src/condor_contrib/mgmt/qmf/plugins/MgmtScheddPlugin.cpp
@@ -187,7 +187,7 @@ MgmtScheddPlugin::initialize()
EXCEPT("%s on job is missing or not an integer", ATTR_JOB_STATUS);
}
- key.sprintf("%d.%d", id.cluster, id.proc);
+ key.formatstr("%d.%d", id.cluster, id.proc);
processJob(key.Value(), ATTR_JOB_STATUS, value);
@@ -413,10 +413,10 @@ MgmtScheddPlugin::processJob(const char *key,
// wrong if the DAGMan job didn't use the
// default, but it is better to be wrong than
// to fail entirely, which is the alternative.
- submissionName.sprintf("%s#%d", Name, dagman.cluster);
+ submissionName.formatstr("%s#%d", Name, dagman.cluster);
}
} else {
- submissionName.sprintf("%s#%d", Name, id.cluster);
+ submissionName.formatstr("%s#%d", Name, id.cluster);
}
MyString tmp;
diff --git a/src/condor_contrib/mgmt/qmf/plugins/NegotiatorObject.cpp b/src/condor_contrib/mgmt/qmf/plugins/NegotiatorObject.cpp
index d2d9619..cacfbaa 100644
--- a/src/condor_contrib/mgmt/qmf/plugins/NegotiatorObject.cpp
+++ b/src/condor_contrib/mgmt/qmf/plugins/NegotiatorObject.cpp
@@ -198,7 +198,7 @@ NegotiatorObject::SetLimit(std::string &name, double max, std::string &text)
name += "_LIMIT";
- config.sprintf("%s=%f", name.c_str(), max);
+ config.formatstr("%s=%f", name.c_str(), max);
if (-1 == set_runtime_config(strdup(name.c_str()),
config.StrDup())) {
@@ -241,7 +241,7 @@ NegotiatorObject::SetRawConfig(std::string &name, std::string &value, std::strin
MyString config;
- config.sprintf("%s=%s", name.c_str(), value.c_str());
+ config.formatstr("%s=%s", name.c_str(), value.c_str());
if (-1 == set_runtime_config(strdup(name.c_str()),
strdup(config.Value()))) {
diff --git a/src/condor_contrib/mgmt/qmf/plugins/SchedulerObject.cpp b/src/condor_contrib/mgmt/qmf/plugins/SchedulerObject.cpp
index 03a73a7..4a05387 100644
--- a/src/condor_contrib/mgmt/qmf/plugins/SchedulerObject.cpp
+++ b/src/condor_contrib/mgmt/qmf/plugins/SchedulerObject.cpp
@@ -283,7 +283,7 @@ SchedulerObject::Submit(Variant::Map &jobAdMap, std::string &id, std::string &te
// 7. Return identifier
// TODO: dag ids?
MyString tmp;
- tmp.sprintf("%s#%d.%d", Name, cluster, proc);
+ tmp.formatstr("%s#%d.%d", Name, cluster, proc);
id = tmp.Value();
return STATUS_OK;
diff --git a/src/condor_contrib/mgmt/qmf/plugins/SubmissionObject.cpp b/src/condor_contrib/mgmt/qmf/plugins/SubmissionObject.cpp
index a76bc17..8486e2a 100644
--- a/src/condor_contrib/mgmt/qmf/plugins/SubmissionObject.cpp
+++ b/src/condor_contrib/mgmt/qmf/plugins/SubmissionObject.cpp
@@ -189,7 +189,7 @@ SubmissionObject::GetJobSummaries ( Variant::List &jobs,
NULL
};
- constraint.sprintf("%s == \"%s\"",
+ constraint.formatstr("%s == \"%s\"",
ATTR_JOB_SUBMISSION, this->m_name.c_str());
dprintf(D_FULLDEBUG,"GetJobSummaries for submission: %s\n",constraint.Value());
diff --git a/src/condor_contrib/triggerd/src/Triggerd.cpp b/src/condor_contrib/triggerd/src/Triggerd.cpp
index 40e1197..0052aed 100644
--- a/src/condor_contrib/triggerd/src/Triggerd.cpp
+++ b/src/condor_contrib/triggerd/src/Triggerd.cpp
@@ -1038,7 +1038,7 @@ Triggerd::InvalidatePublicAd()
invalidate_ad.SetMyTypeName(QUERY_ADTYPE);
invalidate_ad.SetTargetTypeName(GENERIC_ADTYPE);
- line.sprintf("%s == \"%s\"", ATTR_NAME, daemonName.c_str());
+ line.formatstr("%s == \"%s\"", ATTR_NAME, daemonName.c_str());
invalidate_ad.AssignExpr(ATTR_REQUIREMENTS, line.Value());
daemonCore->sendUpdates(INVALIDATE_ADS_GENERIC, &invalidate_ad, NULL, false);
diff --git a/src/condor_daemon_client/dc_schedd.cpp b/src/condor_daemon_client/dc_schedd.cpp
index 062eba9..30c2ca3 100644
--- a/src/condor_daemon_client/dc_schedd.cpp
+++ b/src/condor_daemon_client/dc_schedd.cpp
@@ -1765,19 +1765,19 @@ bool DCSchedd::recycleShadow( int previous_job_exit_reason, ClassAd **new_job_ad
ReliSock sock;
if( !connectSock(&sock,timeout,&errstack) ) {
- error_msg.sprintf("Failed to connect to schedd: %s",
+ error_msg.formatstr("Failed to connect to schedd: %s",
errstack.getFullText());
return false;
}
if( !startCommand(RECYCLE_SHADOW, &sock, timeout, &errstack) ) {
- error_msg.sprintf("Failed to send RECYCLE_SHADOW to schedd: %s",
+ error_msg.formatstr("Failed to send RECYCLE_SHADOW to schedd: %s",
errstack.getFullText());
return false;
}
if( !forceAuthentication(&sock, &errstack) ) {
- error_msg.sprintf("Failed to authenticate: %s",
+ error_msg.formatstr("Failed to authenticate: %s",
errstack.getFullText());
return false;
}
diff --git a/src/condor_daemon_client/dc_starter.cpp b/src/condor_daemon_client/dc_starter.cpp
index c77ad29..feea9b4 100644
--- a/src/condor_daemon_client/dc_starter.cpp
+++ b/src/condor_daemon_client/dc_starter.cpp
@@ -350,7 +350,7 @@ bool DCStarter::startSSHD(char const *known_hosts_file,char const *private_clien
if( !success ) {
std::string remote_error_msg;
result.LookupString(ATTR_ERROR_STRING,remote_error_msg);
- error_msg.sprintf("%s: %s",slot_name,remote_error_msg.c_str());
+ error_msg.formatstr("%s: %s",slot_name,remote_error_msg.c_str());
retry_is_sensible = false;
result.LookupBool(ATTR_RETRY,retry_is_sensible);
return false;
@@ -380,20 +380,20 @@ bool DCStarter::startSSHD(char const *known_hosts_file,char const *private_clien
}
FILE *fp = safe_fcreate_fail_if_exists(private_client_key_file,"a",0400);
if( !fp ) {
- error_msg.sprintf("Failed to create %s: %s",
+ error_msg.formatstr("Failed to create %s: %s",
private_client_key_file,strerror(errno));
free( decode_buf );
return false;
}
if( fwrite(decode_buf,length,1,fp)!=1 ) {
- error_msg.sprintf("Failed to write to %s: %s",
+ error_msg.formatstr("Failed to write to %s: %s",
private_client_key_file,strerror(errno));
fclose( fp );
free( decode_buf );
return false;
}
if( fclose(fp)!=0 ) {
- error_msg.sprintf("Failed to close %s: %s",
+ error_msg.formatstr("Failed to close %s: %s",
private_client_key_file,strerror(errno));
free( decode_buf );
return false;
@@ -412,7 +412,7 @@ bool DCStarter::startSSHD(char const *known_hosts_file,char const *private_clien
}
fp = safe_fcreate_fail_if_exists(known_hosts_file,"a",0600);
if( !fp ) {
- error_msg.sprintf("Failed to create %s: %s",
+ error_msg.formatstr("Failed to create %s: %s",
known_hosts_file,strerror(errno));
free( decode_buf );
return false;
@@ -423,7 +423,7 @@ bool DCStarter::startSSHD(char const *known_hosts_file,char const *private_clien
fprintf(fp,"* ");
if( fwrite(decode_buf,length,1,fp)!=1 ) {
- error_msg.sprintf("Failed to write to %s: %s",
+ error_msg.formatstr("Failed to write to %s: %s",
known_hosts_file,strerror(errno));
fclose( fp );
free( decode_buf );
@@ -431,7 +431,7 @@ bool DCStarter::startSSHD(char const *known_hosts_file,char const *private_clien
}
if( fclose(fp)!=0 ) {
- error_msg.sprintf("Failed to close %s: %s",
+ error_msg.formatstr("Failed to close %s: %s",
known_hosts_file,strerror(errno));
free( decode_buf );
return false;
diff --git a/src/condor_daemon_core.V6/HookClient.cpp b/src/condor_daemon_core.V6/HookClient.cpp
index 63d65b8..b735b8b 100644
--- a/src/condor_daemon_core.V6/HookClient.cpp
+++ b/src/condor_daemon_core.V6/HookClient.cpp
@@ -71,7 +71,7 @@ HookClient::hookExited(int exit_status) {
m_exit_status = exit_status;
MyString status_txt;
- status_txt.sprintf("HookClient %s (pid %d) ", m_hook_path, m_pid);
+ status_txt.formatstr("HookClient %s (pid %d) ", m_hook_path, m_pid);
statusString(exit_status, status_txt);
dprintf(D_FULLDEBUG, "%s\n", status_txt.Value());
diff --git a/src/condor_daemon_core.V6/HookClientMgr.cpp b/src/condor_daemon_core.V6/HookClientMgr.cpp
index d5aff65..75d047c 100644
--- a/src/condor_daemon_core.V6/HookClientMgr.cpp
+++ b/src/condor_daemon_core.V6/HookClientMgr.cpp
@@ -165,7 +165,7 @@ HookClientMgr::reaperIgnore(int exit_pid, int exit_status)
// Some hook that we don't care about the output for just
// exited. All we need is to print a log message (if that).
MyString status_txt;
- status_txt.sprintf("Hook (pid %d) ", exit_pid);
+ status_txt.formatstr("Hook (pid %d) ", exit_pid);
statusString(exit_status, status_txt);
dprintf(D_FULLDEBUG, "%s\n", status_txt.Value());
return TRUE;
diff --git a/src/condor_daemon_core.V6/daemon_command.cpp b/src/condor_daemon_core.V6/daemon_command.cpp
index e6da114..8796717 100644
--- a/src/condor_daemon_core.V6/daemon_command.cpp
+++ b/src/condor_daemon_core.V6/daemon_command.cpp
@@ -793,7 +793,7 @@ DaemonCommandProtocol::CommandProtocolResult DaemonCommandProtocol::ReadCommand(
// generate a unique ID.
MyString tmpStr;
- tmpStr.sprintf( "%s:%i:%i:%i",
+ tmpStr.formatstr( "%s:%i:%i:%i",
get_local_hostname().Value(), daemonCore->mypid,
(int)time(0), ZZZ_always_increase() );
assert (m_sid == NULL);
@@ -1360,7 +1360,7 @@ DaemonCommandProtocol::CommandProtocolResult DaemonCommandProtocol::ExecCommand(
}
MyString command_desc;
- command_desc.sprintf("command %d (%s)",m_req,m_comTable[cmd_index].command_descrip);
+ command_desc.formatstr("command %d (%s)",m_req,m_comTable[cmd_index].command_descrip);
if( m_comTable[cmd_index].force_authentication &&
!m_sock->isMappedFQU() )
diff --git a/src/condor_daemon_core.V6/daemon_core.cpp b/src/condor_daemon_core.V6/daemon_core.cpp
index 477c06f..a2b66e9 100644
--- a/src/condor_daemon_core.V6/daemon_core.cpp
+++ b/src/condor_daemon_core.V6/daemon_core.cpp
@@ -773,7 +773,7 @@ bool DaemonCore::TooManyRegisteredSockets(int fd,MyString *msg,int num_fds)
return false;
}
if(msg) {
- msg->sprintf( "file descriptor safety level exceeded: "
+ msg->formatstr( "file descriptor safety level exceeded: "
" limit %d, "
" registered socket count %d, "
" fd %d",
@@ -2804,7 +2804,7 @@ DaemonCore::reconfig(void) {
// a daemon core parent.
if ( ppid && m_want_send_child_alive ) {
MyString buf;
- buf.sprintf("%s_NOT_RESPONDING_TIMEOUT",get_mySubSystem()->getName());
+ buf.formatstr("%s_NOT_RESPONDING_TIMEOUT",get_mySubSystem()->getName());
max_hang_time = param_integer(buf.Value(),-1);
if( max_hang_time == (unsigned int)-1 ) {
max_hang_time = param_integer("NOT_RESPONDING_TIMEOUT",0);
@@ -6197,7 +6197,7 @@ int DaemonCore::Create_Process(
goto wrapup;
}
- inheritbuf.sprintf("%lu ",(unsigned long)mypid);
+ inheritbuf.formatstr("%lu ",(unsigned long)mypid);
// true = Give me a real local address, circumventing
// CCB's trickery if present. As this address is
@@ -7038,7 +7038,7 @@ int DaemonCore::Create_Process(
if( stat(cwd, &stat_struct) == -1 ) {
return_errno = errno;
if (NULL != err_return_msg) {
- err_return_msg->sprintf("Cannot access specified iwd \"%s\"", cwd);
+ err_return_msg->formatstr("Cannot access specified iwd \"%s\"", cwd);
}
dprintf( D_ALWAYS, "Create_Process: "
"Cannot access specified iwd \"%s\": "
@@ -7068,7 +7068,7 @@ int DaemonCore::Create_Process(
goto wrapup;
}
- executable_fullpath_buf.sprintf("%s/%s", currwd.Value(), executable);
+ executable_fullpath_buf.formatstr("%s/%s", currwd.Value(), executable);
executable_fullpath = executable_fullpath_buf.Value();
// Finally, log it
@@ -8078,7 +8078,7 @@ DaemonCore::Inherit( void )
}
IpVerify* ipv = getSecMan()->getIpVerify();
MyString id;
- id.sprintf("%s", CONDOR_PARENT_FQU);
+ id.formatstr("%s", CONDOR_PARENT_FQU);
ipv->PunchHole(DAEMON, id);
}
}
@@ -9516,7 +9516,7 @@ DaemonCore::CheckConfigAttrSecurity( const char* name, Sock* sock )
// level.
MyString command_desc;
- command_desc.sprintf("remote config %s",name);
+ command_desc.formatstr("remote config %s",name);
if( Verify(command_desc.Value(),(DCpermission)i, sock->peer_addr(), sock->getFullyQualifiedUser())) {
// now we can see if the specific attribute they're
@@ -9845,7 +9845,7 @@ DaemonCore::UpdateLocalAd(ClassAd *daemonAd,char const *fname)
if( fname ) {
MyString newLocalAdFile;
- newLocalAdFile.sprintf("%s.new",fname);
+ newLocalAdFile.formatstr("%s.new",fname);
if( (AD_FILE = safe_fopen_wrapper_follow(newLocalAdFile.Value(), "w")) ) {
daemonAd->fPrint(AD_FILE);
fclose( AD_FILE );
diff --git a/src/condor_daemon_core.V6/daemon_core_main.cpp b/src/condor_daemon_core.V6/daemon_core_main.cpp
index 5c11b04..6515843 100644
--- a/src/condor_daemon_core.V6/daemon_core_main.cpp
+++ b/src/condor_daemon_core.V6/daemon_core_main.cpp
@@ -358,7 +358,7 @@ static void
kill_daemon_ad_file()
{
MyString param_name;
- param_name.sprintf( "%s_DAEMON_AD_FILE", get_mySubSystem()->getName() );
+ param_name.formatstr( "%s_DAEMON_AD_FILE", get_mySubSystem()->getName() );
char *ad_file = param(param_name.Value());
if( !ad_file ) {
return;
@@ -385,7 +385,7 @@ drop_addr_file()
if( addrFile ) {
MyString newAddrFile;
- newAddrFile.sprintf("%s.new",addrFile);
+ newAddrFile.formatstr("%s.new",addrFile);
if( (ADDR_FILE = safe_fopen_wrapper_follow(newAddrFile.Value(), "w")) ) {
// Always prefer the local, private address if possible.
const char* addr = daemonCore->privateNetworkIpAddr();
@@ -608,7 +608,7 @@ set_dynamic_dir( const char* param_name, const char* append_str )
}
// First, create the new name.
- newdir.sprintf( "%s.%s", val, append_str );
+ newdir.formatstr( "%s.%s", val, append_str );
// Next, try to create the given directory, if it doesn't
// already exist.
@@ -2051,7 +2051,7 @@ int dc_main( int argc, char** argv )
// See if the config tells us to wait on startup for a debugger to attach.
MyString debug_wait_param;
- debug_wait_param.sprintf("%s_DEBUG_WAIT", get_mySubSystem()->getName() );
+ debug_wait_param.formatstr("%s_DEBUG_WAIT", get_mySubSystem()->getName() );
if (param_boolean(debug_wait_param.Value(), false, false)) {
volatile int debug_wait = 1;
dprintf(D_ALWAYS,
diff --git a/src/condor_daemon_core.V6/self_draining_queue.cpp b/src/condor_daemon_core.V6/self_draining_queue.cpp
index 97317a9..1ef291d 100644
--- a/src/condor_daemon_core.V6/self_draining_queue.cpp
+++ b/src/condor_daemon_core.V6/self_draining_queue.cpp
@@ -36,7 +36,7 @@ SelfDrainingQueue::SelfDrainingQueue( const char* queue_name, int per )
name = strdup( "(unnamed)" );
}
MyString t_name;
- t_name.sprintf( "SelfDrainingQueue::timerHandler[%s]", name );
+ t_name.formatstr( "SelfDrainingQueue::timerHandler[%s]", name );
timer_name = strdup( t_name.Value() );
handler_fn = NULL;
diff --git a/src/condor_daemon_core.V6/self_monitor.cpp b/src/condor_daemon_core.V6/self_monitor.cpp
index c5506c7..81f4be0 100644
--- a/src/condor_daemon_core.V6/self_monitor.cpp
+++ b/src/condor_daemon_core.V6/self_monitor.cpp
@@ -325,7 +325,7 @@ stats_entry_recent<Probe> * DaemonCore::Stats::AddSample(const char * name, int
stats_entry_recent<Probe> * probe = Pool.GetProbe< stats_entry_recent<Probe> >(name);
if ( ! probe) {
MyString attr;
- attr.sprintf("Recent%s",name);
+ attr.formatstr("Recent%s",name);
cleanStringForUseAsAttr(attr);
int as_pub = as | stats_entry_recent<Probe>::PubValueAndRecent;
probe = Pool.NewProbe< stats_entry_recent<Probe> >(name, attr.Value()+6, as_pub);
@@ -351,7 +351,7 @@ double DaemonCore::Stats::AddRuntimeSample(const char * name, int as, double bef
void* DaemonCore::Stats::New(const char * category, const char * name, int as)
{
MyString attr;
- attr.sprintf("DC%s_%s", category, name);
+ attr.formatstr("DC%s_%s", category, name);
cleanStringForUseAsAttr(attr);
void * ret = NULL;
diff --git a/src/condor_daemon_core.V6/timer_manager.cpp b/src/condor_daemon_core.V6/timer_manager.cpp
index 05c8407..b677009 100644
--- a/src/condor_daemon_core.V6/timer_manager.cpp
+++ b/src/condor_daemon_core.V6/timer_manager.cpp
@@ -543,7 +543,7 @@ void TimerManager::DumpTimerList(int flag, const char* indent)
MyString slice_desc;
if( !timer_ptr->timeslice ) {
- slice_desc.sprintf("period = %d, ", timer_ptr->period);
+ slice_desc.formatstr("period = %d, ", timer_ptr->period);
}
else {
slice_desc.sprintf_cat("timeslice = %.3g, ",
diff --git a/src/condor_dagman/dag.cpp b/src/condor_dagman/dag.cpp
index a7f7655..251d65c 100644
--- a/src/condor_dagman/dag.cpp
+++ b/src/condor_dagman/dag.cpp
@@ -820,7 +820,7 @@ Dag::RemoveBatchJob(Job *node) {
// Adding this DAGMan's cluster ID as a constraint to
// be extra-careful to avoid removing someone else's
// job.
- constraint.sprintf( "%s == %d && %s == %d",
+ constraint.formatstr( "%s == %d && %s == %d",
ATTR_DAGMAN_JOB_ID, _DAGManJobId->_cluster,
ATTR_CLUSTER_ID, node->_CondorID._cluster);
args.AppendArg( constraint.Value() );
@@ -999,16 +999,16 @@ Dag::ProcessPostTermEvent(const ULogEvent *event, Job *job,
MyString errMsg;
if( mainJobRetval > 0 ) {
- errMsg.sprintf( "Job exited with status %d and ",
+ errMsg.formatstr( "Job exited with status %d and ",
mainJobRetval);
}
else if( mainJobRetval < 0 &&
mainJobRetval >= -MAX_SIGNAL ) {
- errMsg.sprintf( "Job died on signal %d and ",
+ errMsg.formatstr( "Job died on signal %d and ",
0 - mainJobRetval);
}
else {
- errMsg.sprintf( "Job failed due to DAGMAN error %d and ",
+ errMsg.formatstr( "Job failed due to DAGMAN error %d and ",
mainJobRetval);
}
@@ -1952,7 +1952,7 @@ void Dag::RemoveRunningJobs ( const Dagman &dm, bool bForce) const {
args.AppendArg( _condorRmExe );
args.AppendArg( "-const" );
- constraint.sprintf( "%s == %d", ATTR_DAGMAN_JOB_ID,
+ constraint.formatstr( "%s == %d", ATTR_DAGMAN_JOB_ID,
dm.DAGManJobId._cluster );
args.AppendArg( constraint.Value() );
if ( util_popen( args ) != 0 ) {
@@ -3218,7 +3218,7 @@ Dag::ChooseDotFileName(MyString &dot_file_name)
while (!found_unused_file) {
FILE *fp;
- dot_file_name.sprintf("%s.%d", _dot_file_name, _dot_file_name_suffix);
+ dot_file_name.formatstr("%s.%d", _dot_file_name, _dot_file_name_suffix);
fp = safe_fopen_wrapper_follow(dot_file_name.Value(), "r");
if (fp != NULL) {
fclose(fp);
@@ -3271,12 +3271,12 @@ Dag::RemoveNode( const char *name, MyString &whynot )
return false;
}
if( node->IsActive() ) {
- whynot.sprintf( "is active (%s)", node->GetStatusName() );
+ whynot.formatstr( "is active (%s)", node->GetStatusName() );
return false;
}
if( !node->IsEmpty( Job::Q_CHILDREN ) ||
!node->IsEmpty( Job::Q_PARENTS ) ) {
- whynot.sprintf( "dependencies exist" );
+ whynot.formatstr( "dependencies exist" );
return false;
}
@@ -3327,7 +3327,7 @@ Dag::RemoveNode( const char *name, MyString &whynot )
// fail to handle it above...
debug_printf( DEBUG_QUIET, "ERROR: node %s in unexpected state (%s)\n",
node->GetJobName(), node->GetStatusName() );
- whynot.sprintf( "node in unexpected state (%s)",
+ whynot.formatstr( "node in unexpected state (%s)",
node->GetStatusName() );
return false;
}
@@ -3590,7 +3590,7 @@ Dag::SanityCheckSubmitEvent( const CondorID condorID, const Job* node )
}
MyString message;
- message.sprintf( "ERROR: node %s: job ID in userlog submit event (%d.%d.%d) "
+ message.formatstr( "ERROR: node %s: job ID in userlog submit event (%d.%d.%d) "
"doesn't match ID reported earlier by submit command "
"(%d.%d.%d)!",
node->GetJobName(), condorID._cluster, condorID._proc,
diff --git a/src/condor_dagman/dagman_commands.cpp b/src/condor_dagman/dagman_commands.cpp
index f8d227d..463e2a5 100644
--- a/src/condor_dagman/dagman_commands.cpp
+++ b/src/condor_dagman/dagman_commands.cpp
@@ -77,7 +77,7 @@ AddNode( Dag *dag, Job::job_type_t type, const char *name,
return false;
}
if( done && isFinal) {
- failReason.sprintf( "Warning: FINAL Job %s cannot be set to DONE\n",
+ failReason.formatstr( "Warning: FINAL Job %s cannot be set to DONE\n",
name );
debug_printf( DEBUG_QUIET, failReason.Value() );
(void)check_warning_strictness( DAG_STRICT_1, false );
@@ -148,13 +148,13 @@ IsValidNodeName( Dag *dag, const char *name, MyString &whynot )
return false;
}
if( isReservedWord( name ) ) {
- whynot.sprintf( "invalid node name: '%s' is a DAGMan reserved word",
+ whynot.formatstr( "invalid node name: '%s' is a DAGMan reserved word",
name );
return false;
}
ASSERT( dag != NULL );
if( dag->NodeExists( name ) ) {
- whynot.sprintf( "node name '%s' already exists in DAG", name );
+ whynot.formatstr( "node name '%s' already exists in DAG", name );
return false;
}
return true;
diff --git a/src/condor_dagman/dagman_main.cpp b/src/condor_dagman/dagman_main.cpp
index d8b2937..6ea627f 100644
--- a/src/condor_dagman/dagman_main.cpp
+++ b/src/condor_dagman/dagman_main.cpp
@@ -610,7 +610,7 @@ void main_init (int argc, char ** const argv) {
// Construct a string of the minimum submit file version.
MyString minSubmitVersionStr;
- minSubmitVersionStr.sprintf( "%d.%d.%d",
+ minSubmitVersionStr.formatstr( "%d.%d.%d",
MIN_SUBMIT_FILE_VERSION.majorVer,
MIN_SUBMIT_FILE_VERSION.minorVer,
MIN_SUBMIT_FILE_VERSION.subMinorVer );
@@ -825,7 +825,7 @@ void main_init (int argc, char ** const argv) {
// Just generate this message fragment in one place.
MyString versionMsg;
- versionMsg.sprintf("the version (%s) of this DAG's Condor submit "
+ versionMsg.formatstr("the version (%s) of this DAG's Condor submit "
"file (created by condor_submit_dag)", csdVersion );
// Make sure version in submit file is valid.
@@ -944,7 +944,7 @@ void main_init (int argc, char ** const argv) {
if ( dagman.doRescueFrom != 0 ) {
rescueDagNum = dagman.doRescueFrom;
- rescueDagMsg.sprintf( "Rescue DAG number %d specified", rescueDagNum );
+ rescueDagMsg.formatstr( "Rescue DAG number %d specified", rescueDagNum );
RenameRescueDagsAfter( dagman.primaryDagFile.Value(),
dagman.multiDags, rescueDagNum, dagman.maxRescueDagNum );
@@ -952,7 +952,7 @@ void main_init (int argc, char ** const argv) {
rescueDagNum = FindLastRescueDagNum(
dagman.primaryDagFile.Value(),
dagman.multiDags, dagman.maxRescueDagNum );
- rescueDagMsg.sprintf( "Found rescue DAG number %d", rescueDagNum );
+ rescueDagMsg.formatstr( "Found rescue DAG number %d", rescueDagNum );
}
//
diff --git a/src/condor_dagman/debug.cpp b/src/condor_dagman/debug.cpp
index 470fc15..de11983 100644
--- a/src/condor_dagman/debug.cpp
+++ b/src/condor_dagman/debug.cpp
@@ -197,9 +197,9 @@ debug_cache_insert(int flags, const char *fmt, va_list args)
if ((HdrFlags & D_NOHEADER) == 0) {
if (UseTimestamps) {
- tstamp.sprintf("(%d) ", (int)clock_now);
+ tstamp.formatstr("(%d) ", (int)clock_now);
} else {
- tstamp.sprintf("%d/%d %02d:%02d:%02d ",
+ tstamp.formatstr("%d/%d %02d:%02d:%02d ",
tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
tm->tm_min, tm->tm_sec );
}
@@ -209,7 +209,7 @@ debug_cache_insert(int flags, const char *fmt, va_list args)
// access to the dprintf FP. For now we're just going
// to skip figuring out the FD *while caching*.
// wenger 2011-05-18
- fds.sprintf("(fd:?) " );
+ fds.formatstr("(fd:?) " );
}
if (HdrFlags & D_PID) {
@@ -218,7 +218,7 @@ debug_cache_insert(int flags, const char *fmt, va_list args)
#else
my_pid = (int) getpid();
#endif
- pid.sprintf("(pid:%d) ", my_pid );
+ pid.formatstr("(pid:%d) ", my_pid );
}
@@ -228,7 +228,7 @@ debug_cache_insert(int flags, const char *fmt, va_list args)
}
// figure out the line the user needs to emit.
- line.vsprintf(fmt, args);
+ line.vformatstr(fmt, args);
// build the cached line and add it to the cache
cache += (tstamp + fds + line);
diff --git a/src/condor_dagman/job.cpp b/src/condor_dagman/job.cpp
index 5cb012f..0990c8a 100644
--- a/src/condor_dagman/job.cpp
+++ b/src/condor_dagman/job.cpp
@@ -400,7 +400,7 @@ Job::CanAddParent( Job* parent, MyString &whynot )
// future once we figure out the right way for the DAG to
// respond...
if( _Status != STATUS_READY && parent->GetStatus() != STATUS_DONE ) {
- whynot.sprintf( "%s child may not be given a new %s parent",
+ whynot.formatstr( "%s child may not be given a new %s parent",
this->GetStatusName(), parent->GetStatusName() );
return false;
}
@@ -516,7 +516,7 @@ Job::AddScript( bool post, const char *cmd, MyString &whynot )
return false;
}
if( post ? _scriptPost : _scriptPre ) {
- whynot.sprintf( "%s script already assigned (%s)",
+ whynot.formatstr( "%s script already assigned (%s)",
post ? "POST" : "PRE", GetPreScriptName() );
return false;
}
@@ -542,7 +542,7 @@ bool
Job::AddPreSkip( int exitCode, MyString &whynot )
{
if( exitCode < PRE_SKIP_MIN || exitCode > PRE_SKIP_MAX ) {
- whynot.sprintf( "PRE_SKIP exit code must be between %d and %d\n",
+ whynot.formatstr( "PRE_SKIP exit code must be between %d and %d\n",
PRE_SKIP_MIN, PRE_SKIP_MAX );
return false;
}
diff --git a/src/condor_dagman/jobstate_log.cpp b/src/condor_dagman/jobstate_log.cpp
index 7d168a7..3feec9e 100644
--- a/src/condor_dagman/jobstate_log.cpp
+++ b/src/condor_dagman/jobstate_log.cpp
@@ -237,7 +237,7 @@ JobstateLog::WriteDagmanStarted( const CondorID &DAGManJobId )
}
MyString info;
- info.sprintf( "%s *** %s %d.%d ***", INTERNAL_NAME, DAGMAN_STARTED_NAME,
+ info.formatstr( "%s *** %s %d.%d ***", INTERNAL_NAME, DAGMAN_STARTED_NAME,
DAGManJobId._cluster, DAGManJobId._proc );
Write( NULL, info );
@@ -253,7 +253,7 @@ JobstateLog::WriteDagmanFinished( int exitCode )
}
MyString info;
- info.sprintf( "%s *** %s %d ***", INTERNAL_NAME, DAGMAN_FINISHED_NAME,
+ info.formatstr( "%s *** %s %d ***", INTERNAL_NAME, DAGMAN_FINISHED_NAME,
exitCode );
Write( NULL, info );
@@ -269,7 +269,7 @@ JobstateLog::WriteRecoveryStarted()
}
MyString info;
- info.sprintf( "%s *** %s ***", INTERNAL_NAME, RECOVERY_STARTED_NAME );
+ info.formatstr( "%s *** %s ***", INTERNAL_NAME, RECOVERY_STARTED_NAME );
Write( NULL, info );
}
@@ -282,7 +282,7 @@ JobstateLog::WriteRecoveryFinished()
}
MyString info;
- info.sprintf( "%s *** %s ***", INTERNAL_NAME, RECOVERY_FINISHED_NAME );
+ info.formatstr( "%s *** %s ***", INTERNAL_NAME, RECOVERY_FINISHED_NAME );
Write( NULL, info );
Flush();
}
@@ -296,7 +296,7 @@ JobstateLog::WriteRecoveryFailure()
}
MyString info;
- info.sprintf( "%s *** %s ***", INTERNAL_NAME, RECOVERY_FAILURE_NAME );
+ info.formatstr( "%s *** %s ***", INTERNAL_NAME, RECOVERY_FAILURE_NAME );
Write( NULL, info );
Flush();
}
@@ -343,7 +343,7 @@ JobstateLog::WriteJobSuccessOrFailure( Job *node )
const char *eventName = node->retval == 0 ?
JOB_SUCCESS_NAME : JOB_FAILURE_NAME;
MyString retval;
- retval.sprintf( "%d", node->retval );
+ retval.formatstr( "%d", node->retval );
time_t timestamp = node->GetLastEventTime();
Write( ×tamp, node, eventName, retval.Value() );
@@ -420,7 +420,7 @@ JobstateLog::Write( const time_t *eventTimeP, Job *node,
{
MyString info;
- info.sprintf( "%s %s %s %s - %d", node->GetJobName(), eventName,
+ info.formatstr( "%s %s %s %s - %d", node->GetJobName(), eventName,
condorID, node->GetJobstateJobTag(),
node->GetJobstateSequenceNum() );
Write( eventTimeP, info );
@@ -454,7 +454,7 @@ JobstateLog::Write( const time_t *eventTimeP, const MyString &info )
}
MyString outline;
- outline.sprintf( "%lu %s", (unsigned long)eventTime, info.Value() );
+ outline.formatstr( "%lu %s", (unsigned long)eventTime, info.Value() );
//
// If this event's time matches the time of the last "real"
@@ -487,7 +487,7 @@ JobstateLog::CondorID2Str( int cluster, int proc, MyString &idStr )
{
// Make sure Condor ID is valid.
if ( cluster != DEFAULT_CONDOR_ID._cluster ) {
- idStr.sprintf( "%d.%d", cluster, proc );
+ idStr.formatstr( "%d.%d", cluster, proc );
} else {
idStr = "-";
}
diff --git a/src/condor_dagman/parse.cpp b/src/condor_dagman/parse.cpp
index acdbf28..7f489e8 100644
--- a/src/condor_dagman/parse.cpp
+++ b/src/condor_dagman/parse.cpp
@@ -434,7 +434,7 @@ parse_node( Dag *dag, Job::job_type_t nodeType,
Dag *tmp = NULL;
MyString expectedSyntax;
- expectedSyntax.sprintf( "Expected syntax: %s%s nodename %s "
+ expectedSyntax.formatstr( "Expected syntax: %s%s nodename %s "
"[DIR directory] [NOOP] [DONE]", nodeTypeKeyword, inlineOrExt,
submitOrDagFile );
@@ -1837,7 +1837,7 @@ parse_reject(
}
MyString location;
- location.sprintf( "%s (line %d)", filename, lineNumber );
+ location.formatstr( "%s (line %d)", filename, lineNumber );
debug_printf( DEBUG_QUIET, "REJECT specification at %s "
"will cause this DAG to fail\n", location.Value() );
diff --git a/src/condor_gridmanager/dcloudjob.cpp b/src/condor_gridmanager/dcloudjob.cpp
index a8602e6..70196c1 100644
--- a/src/condor_gridmanager/dcloudjob.cpp
+++ b/src/condor_gridmanager/dcloudjob.cpp
@@ -287,7 +287,7 @@ DCloudJob::~DCloudJob()
if ( m_instanceId ) {
MyString hashname;
- hashname.sprintf( "%s#%s", m_serviceUrl, m_instanceId );
+ hashname.formatstr( "%s#%s", m_serviceUrl, m_instanceId );
JobsByInstanceId.insert( HashKey( hashname.Value() ), this );
}
@@ -986,13 +986,13 @@ void DCloudJob::SetInstanceId( const char *instance_id )
{
MyString hashname;
if ( m_instanceId ) {
- hashname.sprintf( "%s#%s", m_serviceUrl, m_instanceId );
+ hashname.formatstr( "%s#%s", m_serviceUrl, m_instanceId );
JobsByInstanceId.remove( HashKey( hashname.Value() ) );
free( m_instanceId );
}
if ( instance_id ) {
m_instanceId = strdup( instance_id );
- hashname.sprintf( "%s#%s", m_serviceUrl, m_instanceId );
+ hashname.formatstr( "%s#%s", m_serviceUrl, m_instanceId );
JobsByInstanceId.insert( HashKey( hashname.Value() ), this );
} else {
m_instanceId = NULL;
@@ -1005,7 +1005,7 @@ void DCloudJob::SetRemoteJobId( const char *instance_name, const char *instance_
{
MyString full_job_id;
if ( instance_name && instance_name[0] ) {
- full_job_id.sprintf( "deltacloud %s", instance_name );
+ full_job_id.formatstr( "deltacloud %s", instance_name );
if ( instance_id && instance_id[0] ) {
full_job_id.sprintf_cat( " %s", instance_id );
}
diff --git a/src/condor_gridmanager/dcloudresource.cpp b/src/condor_gridmanager/dcloudresource.cpp
index 077ad00..e2a7e26 100644
--- a/src/condor_gridmanager/dcloudresource.cpp
+++ b/src/condor_gridmanager/dcloudresource.cpp
@@ -34,7 +34,7 @@ const char * DCloudResource::HashName( const char *resource_name,
const char *password )
{
static MyString hash_name;
- hash_name.sprintf( "%s#%s#%s", resource_name, username, password );
+ hash_name.formatstr( "%s#%s#%s", resource_name, username, password );
return hash_name.Value();
}
@@ -196,7 +196,7 @@ DCloudResource::BatchStatusResult DCloudResource::StartBatchStatus()
(status = statuses.next()) ) {
MyString hashname;
- hashname.sprintf( "%s#%s", ResourceName(), instance_id );
+ hashname.formatstr( "%s#%s", ResourceName(), instance_id );
DCloudJob *job = NULL;
// TODO We can get rid of the hashtable.
diff --git a/src/condor_gridmanager/gahp-client.cpp b/src/condor_gridmanager/gahp-client.cpp
index 98be85e..58056ac 100644
--- a/src/condor_gridmanager/gahp-client.cpp
+++ b/src/condor_gridmanager/gahp-client.cpp
@@ -6692,7 +6692,7 @@ int GahpClient::dcloud_submit( const char *service_url,
char* esc11 = strdup( escapeGahpString(keyname) );
char* esc12 = strdup( escapeGahpString(userdata) );
- bool x = reqline.sprintf("%s %s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3,
+ bool x = reqline.formatstr("%s %s %s %s %s %s %s %s %s %s %s %s", esc1, esc2, esc3,
esc4, esc5, esc6, esc7, esc8, esc9, esc10, esc11, esc12);
free( esc1 );
@@ -6790,7 +6790,7 @@ int GahpClient::dcloud_status_all( const char *service_url,
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
- bool x = reqline.sprintf("%s %s %s", esc1, esc2, esc3);
+ bool x = reqline.formatstr("%s %s %s", esc1, esc2, esc3);
free( esc1 );
free( esc2 );
@@ -6892,7 +6892,7 @@ int GahpClient::dcloud_action( const char *service_url,
char* esc4 = strdup( escapeGahpString(instance_id) );
char* esc5 = strdup( escapeGahpString(action) );
- bool x = reqline.sprintf("%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5);
+ bool x = reqline.formatstr("%s %s %s %s %s", esc1, esc2, esc3, esc4, esc5);
free( esc1 );
free( esc2 );
@@ -6976,7 +6976,7 @@ int GahpClient::dcloud_info( const char *service_url,
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(instance_id) );
- bool x = reqline.sprintf("%s %s %s %s", esc1, esc2, esc3, esc4);
+ bool x = reqline.formatstr("%s %s %s %s", esc1, esc2, esc3, esc4);
free( esc1 );
free( esc2 );
@@ -7068,7 +7068,7 @@ int GahpClient::dcloud_find( const char *service_url,
char* esc3 = strdup( escapeGahpString(password) );
char* esc4 = strdup( escapeGahpString(instance_name) );
- bool x = reqline.sprintf("%s %s %s %s", esc1, esc2, esc3, esc4);
+ bool x = reqline.formatstr("%s %s %s %s", esc1, esc2, esc3, esc4);
free( esc1 );
free( esc2 );
@@ -7157,7 +7157,7 @@ int GahpClient::dcloud_get_max_name_length( const char *service_url,
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
- bool x = reqline.sprintf("%s %s %s", esc1, esc2, esc3);
+ bool x = reqline.formatstr("%s %s %s", esc1, esc2, esc3);
free( esc1 );
free( esc2 );
@@ -7243,7 +7243,7 @@ int GahpClient::dcloud_start_auto( const char *service_url,
char* esc2 = strdup( escapeGahpString(username) );
char* esc3 = strdup( escapeGahpString(password) );
- bool x = reqline.sprintf("%s %s %s", esc1, esc2, esc3);
+ bool x = reqline.formatstr("%s %s %s", esc1, esc2, esc3);
free( esc1 );
free( esc2 );
diff --git a/src/condor_had/DownloadReplicaTransferer.cpp b/src/condor_had/DownloadReplicaTransferer.cpp
index 97d5fca..f107844 100644
--- a/src/condor_had/DownloadReplicaTransferer.cpp
+++ b/src/condor_had/DownloadReplicaTransferer.cpp
@@ -142,7 +142,7 @@ int
DownloadReplicaTransferer::download( ) {
MyString extension;
- extension.sprintf( "%d.%s",
+ extension.formatstr( "%d.%s",
daemonCore->getpid( ),
DOWNLOADING_TEMPORARY_FILES_EXTENSION );
// download version file
diff --git a/src/condor_had/ReplicatorStateMachine.cpp b/src/condor_had/ReplicatorStateMachine.cpp
index 500631e..b4e2b44 100644
--- a/src/condor_had/ReplicatorStateMachine.cpp
+++ b/src/condor_had/ReplicatorStateMachine.cpp
@@ -103,7 +103,7 @@ ReplicatorStateMachine::finalizeDelta( )
invalidate_ad.SetMyTypeName( QUERY_ADTYPE );
invalidate_ad.SetTargetTypeName( "Replication" );
- line.sprintf( "TARGET.%s == \"%s\"", ATTR_NAME, m_name.Value( ) );
+ line.formatstr( "TARGET.%s == \"%s\"", ATTR_NAME, m_name.Value( ) );
invalidate_ad.AssignExpr( ATTR_REQUIREMENTS, line.Value( ) );
invalidate_ad.Assign( ATTR_NAME, m_name.Value() );
daemonCore->sendUpdates( INVALIDATE_ADS_GENERIC, &invalidate_ad, NULL, false );
@@ -222,7 +222,7 @@ ReplicatorStateMachine::initializeClassAd()
m_classAd->SetMyTypeName("Replication");
m_classAd->SetTargetTypeName("");
- m_name.sprintf( "replication@%s -p %d", my_full_hostname( ),
+ m_name.formatstr( "replication@%s -p %d", my_full_hostname( ),
daemonCore->InfoCommandPort( ) );
m_classAd->Assign( ATTR_NAME, m_name.Value( ) );
m_classAd->Assign( ATTR_MY_ADDRESS,
diff --git a/src/condor_had/StateMachine.cpp b/src/condor_had/StateMachine.cpp
index 067c726..8bed706 100644
--- a/src/condor_had/StateMachine.cpp
+++ b/src/condor_had/StateMachine.cpp
@@ -132,7 +132,7 @@ HADStateMachine::~HADStateMachine(void)
invalidate_ad.SetMyTypeName( QUERY_ADTYPE );
invalidate_ad.SetTargetTypeName( HAD_ADTYPE );
- line.sprintf( "TARGET.%s == \"%s\"", ATTR_NAME, m_name.Value( ) );
+ line.formatstr( "TARGET.%s == \"%s\"", ATTR_NAME, m_name.Value( ) );
invalidate_ad.AssignExpr( ATTR_REQUIREMENTS, line.Value( ) );
invalidate_ad.Assign( ATTR_NAME, m_name.Value() );
daemonCore->sendUpdates( INVALIDATE_HAD_ADS, &invalidate_ad, NULL, false );
@@ -208,7 +208,7 @@ HADStateMachine::softReconfigure(void)
// 'my_username' allocates dynamic string
buffer = my_username();
tmp = buffer ? buffer : "UNKNOWN";
- m_name.sprintf( "%s@%s", tmp, my_full_hostname( ) );
+ m_name.formatstr( "%s@%s", tmp, my_full_hostname( ) );
if ( buffer ) {
free( buffer );
}
diff --git a/src/condor_had/Utils.cpp b/src/condor_had/Utils.cpp
index fa422cf..1e26012 100644
--- a/src/condor_had/Utils.cpp
+++ b/src/condor_had/Utils.cpp
@@ -49,10 +49,10 @@ utilNoParameterError( const char* parameter, const char* daemonName )
MyString error;
if( ! strcasecmp( daemonName, "HAD" ) ) {
- error.sprintf( "HAD configuration error: no %s in config file",
+ error.formatstr( "HAD configuration error: no %s in config file",
parameter );
} else if( ! strcasecmp( daemonName, "REPLICATION" ) ) {
- error.sprintf( "Replication configuration error: no %s in config file",
+ error.formatstr( "Replication configuration error: no %s in config file",
parameter );
} else {
dprintf( D_ALWAYS, "utilNoParameterError no such daemon name %s\n",
@@ -68,10 +68,10 @@ utilConfigurationError( const char* parameter, const char* daemonName )
MyString error;
if( ! strcasecmp( daemonName, "HAD" ) ) {
- error.sprintf("HAD configuration error: %s is not valid in config file",
+ error.formatstr("HAD configuration error: %s is not valid in config file",
parameter );
} else if( ! strcasecmp( daemonName, "REPLICATION" ) ) {
- error.sprintf( "Replication configuration error: %s is not valid "
+ error.formatstr( "Replication configuration error: %s is not valid "
"in config file", parameter );
} else {
dprintf( D_ALWAYS, "utilConfigurationError no such daemon name %s\n",
diff --git a/src/condor_io/condor_auth_claim.cpp b/src/condor_io/condor_auth_claim.cpp
index 4065f8b..824f6d1 100644
--- a/src/condor_io/condor_auth_claim.cpp
+++ b/src/condor_io/condor_auth_claim.cpp
@@ -181,7 +181,7 @@ int Condor_Auth_Claim :: authenticate(const char * /* remoteHost */, CondorError
}
ASSERT(tmpDomain);
setRemoteDomain(tmpDomain);
- myUser.sprintf("%s@%s", tmpUser, tmpDomain);
+ myUser.formatstr("%s@%s", tmpUser, tmpDomain);
free(tmpDomain);
}
setRemoteUser(tmpUser);
diff --git a/src/condor_io/condor_auth_passwd.cpp b/src/condor_io/condor_auth_passwd.cpp
index 2df2a1e..eac0a8c 100644
--- a/src/condor_io/condor_auth_passwd.cpp
+++ b/src/condor_io/condor_auth_passwd.cpp
@@ -109,11 +109,11 @@ Condor_Auth_Passwd::fetchLogin()
// decide the login name we will try to authenticate with.
if ( is_root() ) {
- login.sprintf("%s@%s",POOL_PASSWORD_USERNAME,getLocalDomain());
+ login.formatstr("%s@%s",POOL_PASSWORD_USERNAME,getLocalDomain());
} else {
// for now, always use the POOL_PASSWORD_USERNAME. at some
// point this code should call my_username() my_domainname().
- login.sprintf("%s@%s",POOL_PASSWORD_USERNAME,getLocalDomain());
+ login.formatstr("%s@%s",POOL_PASSWORD_USERNAME,getLocalDomain());
}
return strdup( login.Value() );
diff --git a/src/condor_io/condor_ipverify.cpp b/src/condor_io/condor_ipverify.cpp
index fc426b7..e4824ae 100644
--- a/src/condor_io/condor_ipverify.cpp
+++ b/src/condor_io/condor_ipverify.cpp
@@ -413,7 +413,7 @@ IpVerify::AuthEntryToString(const in6_addr & host, const char * user, perm_mask_
MyString mask_str;
PermMaskToString( mask, mask_str );
- result.sprintf("%s/%s: %s", /* NOTE: this does not need a '\n', all the call sites add one. */
+ result.formatstr("%s/%s: %s", /* NOTE: this does not need a '\n', all the call sites add one. */
user ? user : "(null)",
buf,
mask_str.Value() );
@@ -711,11 +711,11 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
MyString id;
int count;
if ( who != TotallyWild ) {
- id_with_ip.sprintf("%s/%s", who, ip_str);
+ id_with_ip.formatstr("%s/%s", who, ip_str);
id = who;
if ( hpt->lookup(id, count) != -1 ) {
if( allow_reason ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s authorization has been made automatic for %s",
PermString(perm), id.Value() );
}
@@ -723,7 +723,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
}
if ( hpt->lookup(id_with_ip, count) != -1 ) {
if( allow_reason ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s authorization has been made automatic for %s",
PermString(perm), id_with_ip.Value() );
}
@@ -733,7 +733,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
id = ip_str;
if ( hpt->lookup(id, count) != -1 ) {
if( allow_reason ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s authorization has been made automatic for %s",
PermString(perm), id.Value() );
}
@@ -745,7 +745,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
// allow if no HOSTALLOW_* or HOSTDENY_* restrictions
// specified.
if( allow_reason ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s authorization policy allows access by anyone",
PermString(perm));
}
@@ -755,7 +755,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
if ( PermTypeArray[perm]->behavior == USERVERIFY_DENY ) {
// deny
if( deny_reason ) {
- deny_reason->sprintf(
+ deny_reason->formatstr(
"%s authorization policy denies all access",
PermString(perm));
}
@@ -764,12 +764,12 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
if( LookupCachedVerifyResult(perm,sin6_addr,who,mask) ) {
if( deny_reason && (mask&deny_mask(perm)) ) {
- deny_reason->sprintf(
+ deny_reason->formatstr(
"cached result for %s; see first case for the full reason",
PermString(perm));
}
else if( allow_reason && (mask&allow_mask(perm)) ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"cached result for %s; see first case for the full reason",
PermString(perm));
}
@@ -792,7 +792,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
if ( !(mask&deny_resolved) && lookup_user_ip_deny(perm,who,ipstr)) {
mask |= deny_mask(perm);
if( deny_reason ) {
- deny_reason->sprintf(
+ deny_reason->formatstr(
"%s authorization policy denies IP address %s",
PermString(perm), addr.to_ip_string().Value() );
}
@@ -801,7 +801,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
if ( !(mask&allow_resolved) && lookup_user_ip_allow(perm,who,ipstr)) {
mask |= allow_mask(perm);
if( allow_reason ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s authorization policy allows IP address %s",
PermString(perm), addr.to_ip_string().Value() );
}
@@ -821,7 +821,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
if ( !(mask&deny_resolved) && lookup_user_host_deny(perm,who,thehost) ) {
mask |= deny_mask(perm);
if( deny_reason ) {
- deny_reason->sprintf(
+ deny_reason->formatstr(
"%s authorization policy denies hostname %s",
PermString(perm), thehost );
}
@@ -830,7 +830,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
if ( !(mask&allow_resolved) && lookup_user_host_allow(perm,who,thehost) ) {
mask |= allow_mask(perm);
if( allow_reason ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s authorization policy allows hostname %s",
PermString(perm), thehost );
}
@@ -850,7 +850,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
if ( PermTypeArray[perm]->behavior == USERVERIFY_ONLY_DENIES ) {
dprintf(D_SECURITY,"IPVERIFY: %s at %s not matched to deny list, so allowing.\n",who, addr.to_sinful().Value());
if( allow_reason ) {
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s authorization policy does not deny, so allowing",
PermString(perm));
}
@@ -868,7 +868,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
dprintf(D_SECURITY,"IPVERIFY: allowing %s at %s for %s because %s is allowed\n",who, addr.to_sinful().Value(),PermString(perm),PermString(*parent_perms));
if( allow_reason ) {
MyString tmp = *allow_reason;
- allow_reason->sprintf(
+ allow_reason->formatstr(
"%s is implied by %s; %s",
PermString(perm),
PermString(*parent_perms),
@@ -889,7 +889,7 @@ IpVerify::Verify( DCpermission perm, const condor_sockaddr& addr, const char * u
// In case the reason we didn't match is
// because of a typo or a DNS problem, record
// all the hostnames we searched for.
- deny_reason->sprintf(
+ deny_reason->formatstr(
"%s authorization policy contains no matching "
"ALLOW entry for this request"
"; identifiers used for this host: %s, hostname size = %lu, "
diff --git a/src/condor_io/condor_secman.cpp b/src/condor_io/condor_secman.cpp
index 393b32e..8460527 100644
--- a/src/condor_io/condor_secman.cpp
+++ b/src/condor_io/condor_secman.cpp
@@ -319,7 +319,7 @@ SecMan::getSecSetting_implementation( int *int_result,char **str_result, const c
if( check_subsystem ) {
// First see if there is a specific config entry for the
// specified condor subsystem.
- buf.sprintf( fmt, PermString(*perms) );
+ buf.formatstr( fmt, PermString(*perms) );
buf.sprintf_cat("_%s",check_subsystem);
if( int_result ) {
found = param_integer( buf.Value(), *int_result, false, 0, false, 0, 0 );
@@ -337,7 +337,7 @@ SecMan::getSecSetting_implementation( int *int_result,char **str_result, const c
}
}
- buf.sprintf( fmt, PermString(*perms) );
+ buf.formatstr( fmt, PermString(*perms) );
if( int_result ) {
found = param_integer( buf.Value(), *int_result, false, 0, false, 0, 0 );
}
@@ -559,7 +559,7 @@ SecMan::FillInSecurityPolicyAd( DCpermission auth_level, ClassAd* ad,
// For historical reasons, session duration is inserted as a string
// in the ClassAd
MyString session_duration_buf;
- session_duration_buf.sprintf("%d",session_duration);
+ session_duration_buf.formatstr("%d",session_duration);
ad->Assign ( ATTR_SEC_SESSION_DURATION, session_duration_buf );
int session_lease = 3600;
@@ -892,7 +892,7 @@ class SecManStartCommand: Service, public ClassyCountedPtr {
m_cmd_description = cmd_description;
}
else {
- m_cmd_description.sprintf("command %d",m_cmd);
+ m_cmd_description.formatstr("command %d",m_cmd);
}
}
m_already_logged_startcommand = false;
@@ -1174,7 +1174,7 @@ SecManStartCommand::startCommand_inner()
if( m_sock->deadline_expired() ) {
MyString msg;
- msg.sprintf("deadline for %s %s has expired.",
+ msg.formatstr("deadline for %s %s has expired.",
m_is_tcp && !m_sock->is_connected() ?
"connection to" : "security handshake with",
m_sock->peer_description());
@@ -1191,7 +1191,7 @@ SecManStartCommand::startCommand_inner()
}
else if( m_is_tcp && !m_sock->is_connected()) {
MyString msg;
- msg.sprintf("TCP connection to %s failed.",
+ msg.formatstr("TCP connection to %s failed.",
m_sock->peer_description());
dprintf(D_SECURITY,"SECMAN: %s\n", msg.Value());
m_errstack->pushf("SECMAN", SECMAN_ERR_CONNECT_FAILED,
@@ -1265,7 +1265,7 @@ SecManStartCommand::sendAuthInfo_inner()
}
}
- m_session_key.sprintf ("{%s,<%i>}", m_sock->get_connect_addr(), m_cmd);
+ m_session_key.formatstr ("{%s,<%i>}", m_sock->get_connect_addr(), m_cmd);
bool found_map_ent = false;
if( !m_have_session && !m_raw_protocol && !m_use_tmp_sec_session ) {
found_map_ent = (m_sec_man.command_map->lookup(m_session_key, sid) == 0);
@@ -2039,7 +2039,7 @@ SecManStartCommand::receivePostAuthInfo_inner()
coms.rewind();
while ( (p = coms.next()) ) {
MyString keybuf;
- keybuf.sprintf ("{%s,<%s>}", m_sock->get_connect_addr(), p);
+ keybuf.formatstr ("{%s,<%s>}", m_sock->get_connect_addr(), p);
// NOTE: HashTable returns ZERO on SUCCESS!!!
if (m_sec_man.command_map->insert(keybuf, sesid) == 0) {
@@ -2292,7 +2292,7 @@ SecManStartCommand::WaitForSocketCallback()
}
MyString req_description;
- req_description.sprintf("SecManStartCommand::WaitForSocketCallback %s",
+ req_description.formatstr("SecManStartCommand::WaitForSocketCallback %s",
m_cmd_description.Value());
int reg_rc = daemonCoreSockAdapter.Register_Socket(
m_sock,
@@ -2304,7 +2304,7 @@ SecManStartCommand::WaitForSocketCallback()
if(reg_rc < 0) {
MyString msg;
- msg.sprintf("StartCommand to %s failed because "
+ msg.formatstr("StartCommand to %s failed because "
"Register_Socket returned %d.",
m_sock->get_sinful_peer(),
reg_rc);
@@ -2749,7 +2749,7 @@ char* SecMan::my_unique_id() {
#endif
MyString tid;
- tid.sprintf( "%s:%i:%i", get_local_hostname().Value(), mypid,
+ tid.formatstr( "%s:%i:%i", get_local_hostname().Value(), mypid,
(int)time(0));
_my_unique_id = strdup(tid.Value());
diff --git a/src/condor_io/shared_port_client.cpp b/src/condor_io/shared_port_client.cpp
index aee0a45..d062e6e 100644
--- a/src/condor_io/shared_port_client.cpp
+++ b/src/condor_io/shared_port_client.cpp
@@ -250,7 +250,7 @@ SharedPortClient::PassSocket(Sock *sock_to_pass,char const *shared_port_id,char
MyString requested_by_buf;
if( !requested_by ) {
- requested_by_buf.sprintf(
+ requested_by_buf.formatstr(
" as requested by %s", sock_to_pass->peer_description());
requested_by = requested_by_buf.Value();
}
diff --git a/src/condor_io/shared_port_endpoint.cpp b/src/condor_io/shared_port_endpoint.cpp
index ff3efc3..004e27e 100644
--- a/src/condor_io/shared_port_endpoint.cpp
+++ b/src/condor_io/shared_port_endpoint.cpp
@@ -78,10 +78,10 @@ SharedPortEndpoint::SharedPortEndpoint(char const *sock_name):
}
if( !sequence ) {
- m_local_id.sprintf("%lu_%04hx",(unsigned long)getpid(),rand_tag);
+ m_local_id.formatstr("%lu_%04hx",(unsigned long)getpid(),rand_tag);
}
else {
- m_local_id.sprintf("%lu_%04hx_%u",(unsigned long)getpid(),rand_tag,sequence);
+ m_local_id.formatstr("%lu_%04hx_%u",(unsigned long)getpid(),rand_tag,sequence);
}
sequence++;
@@ -277,7 +277,7 @@ SharedPortEndpoint::CreateListener()
m_listener_sock.close();
m_listener_sock.assign(sock_fd);
- m_full_name.sprintf(
+ m_full_name.formatstr(
"%s%c%s",m_socket_dir.Value(),DIR_DELIM_CHAR,m_local_id.Value());
struct sockaddr_un named_sock_addr;
@@ -1058,7 +1058,7 @@ SharedPortEndpoint::deserialize(char *inherit_buf)
char *ptr;
ptr = strchr(inherit_buf,'*');
ASSERT( ptr );
- m_full_name.sprintf("%.*s",(int)(ptr-inherit_buf),inherit_buf);
+ m_full_name.formatstr("%.*s",(int)(ptr-inherit_buf),inherit_buf);
inherit_buf = ptr+1;
m_local_id = condor_basename( m_full_name.Value() );
@@ -1170,7 +1170,7 @@ SharedPortEndpoint::UseSharedPort(MyString *why_not,bool already_open)
}
if( !cached_result && why_not ) {
- why_not->sprintf("cannot write to %s: %s",
+ why_not->formatstr("cannot write to %s: %s",
socket_dir.Value(),
strerror(errno));
}
diff --git a/src/condor_io/shared_port_server.cpp b/src/condor_io/shared_port_server.cpp
index 8734485..62046a7 100644
--- a/src/condor_io/shared_port_server.cpp
+++ b/src/condor_io/shared_port_server.cpp
@@ -170,7 +170,7 @@ SharedPortServer::HandleConnectRequest(int,Stream *sock)
sock->set_deadline_timeout( deadline );
if( IsDebugLevel( D_NETWORK ) ) {
- deadline_desc.sprintf(" (deadline %ds)", deadline);
+ deadline_desc.formatstr(" (deadline %ds)", deadline);
}
}
diff --git a/src/condor_job_router/JobRouter.cpp b/src/condor_job_router/JobRouter.cpp
index 767c2f0..75a9751 100644
--- a/src/condor_job_router/JobRouter.cpp
+++ b/src/condor_job_router/JobRouter.cpp
@@ -2184,7 +2184,7 @@ JobRouter::InvalidatePublicAd() {
invalidate_ad.SetMyTypeName(QUERY_ADTYPE);
invalidate_ad.SetTargetTypeName("Job_Router");
- line.sprintf("%s == \"%s\"", ATTR_NAME, daemonName.c_str());
+ line.formatstr("%s == \"%s\"", ATTR_NAME, daemonName.c_str());
invalidate_ad.AssignExpr(ATTR_REQUIREMENTS, line.Value());
daemonCore->sendUpdates(INVALIDATE_ADS_GENERIC, &invalidate_ad, NULL, false);
}
@@ -2229,7 +2229,7 @@ JobRoute::ThrottleDesc(double throttle) {
}
else {
MyString buf;
- buf.sprintf("%g jobs/sec",throttle/THROTTLE_UPDATE_INTERVAL);
+ buf.formatstr("%g jobs/sec",throttle/THROTTLE_UPDATE_INTERVAL);
desc = buf.Value();
}
return desc;
diff --git a/src/condor_job_router/JobRouterHookMgr.cpp b/src/condor_job_router/JobRouterHookMgr.cpp
index 16e99a5..7aa089f 100644
--- a/src/condor_job_router/JobRouterHookMgr.cpp
+++ b/src/condor_job_router/JobRouterHookMgr.cpp
@@ -150,7 +150,7 @@ JobRouterHookMgr::getHookPath(HookType hook_type, classad::ClassAd ad)
if (NULL == hook_path)
{
MyString _param;
- _param.sprintf("%s_HOOK_%s", keyword.c_str(), getHookTypeString(hook_type));
+ _param.formatstr("%s_HOOK_%s", keyword.c_str(), getHookTypeString(hook_type));
// Here the distinction between undefined hook and a hook path error
// is being collapsed
validateHookPath(_param.Value(), hook_path);
diff --git a/src/condor_job_router/submit_job.cpp b/src/condor_job_router/submit_job.cpp
index ccad171..5811595 100644
--- a/src/condor_job_router/submit_job.cpp
+++ b/src/condor_job_router/submit_job.cpp
@@ -127,13 +127,13 @@ ClaimJobResult claim_job(int cluster, int proc, MyString * error_details, const
int status;
if( GetAttributeInt(cluster, proc, ATTR_JOB_STATUS, &status) == -1) {
if(error_details) {
- error_details->sprintf("Encountered problem reading current %s for %d.%d", ATTR_JOB_STATUS, cluster, proc);
+ error_details->formatstr("Encountered problem reading current %s for %d.%d", ATTR_JOB_STATUS, cluster, proc);
}
return CJR_ERROR;
}
if(status != IDLE) {
if(error_details) {
- error_details->sprintf("Job %d.%d isn't idle, is %s (%d)", cluster, proc, getJobStatusString(status), status);
+ error_details->formatstr("Job %d.%d isn't idle, is %s (%d)", cluster, proc, getJobStatusString(status), status);
}
return CJR_BUSY;
}
@@ -145,7 +145,7 @@ ClaimJobResult claim_job(int cluster, int proc, MyString * error_details, const
free(managed);
if( ! ok ) {
if(error_details) {
- error_details->sprintf("Job %d.%d is already managed by another process", cluster, proc);
+ error_details->formatstr("Job %d.%d is already managed by another process", cluster, proc);
}
return CJR_BUSY;
}
@@ -155,7 +155,7 @@ ClaimJobResult claim_job(int cluster, int proc, MyString * error_details, const
// No one else has a claim. Claim it ourselves.
if( SetAttributeString(cluster, proc, ATTR_JOB_MANAGED, MANAGED_EXTERNAL) == -1 ) {
if(error_details) {
- error_details->sprintf("Encountered problem setting %s = %s", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
+ error_details->formatstr("Encountered problem setting %s = %s", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
}
return CJR_ERROR;
}
@@ -163,7 +163,7 @@ ClaimJobResult claim_job(int cluster, int proc, MyString * error_details, const
if(my_identity) {
if( SetAttributeString(cluster, proc, ATTR_JOB_MANAGED_MANAGER, my_identity) == -1 ) {
if(error_details) {
- error_details->sprintf("Encountered problem setting %s = %s", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
+ error_details->formatstr("Encountered problem setting %s = %s", ATTR_JOB_MANAGED, MANAGED_EXTERNAL);
}
return CJR_ERROR;
}
@@ -238,7 +238,7 @@ static ClaimJobResult claim_job_with_current_privs(const char * pool_name, const
if( ! DisconnectQ(qmgr, true /* commit */)) {
failobj.fail("Failed to commit job claim\n");
if(error_details && res == CJR_OK) {
- error_details->sprintf("Failed to commit job claim for schedd %s in pool %s",
+ error_details->formatstr("Failed to commit job claim for schedd %s in pool %s",
schedd_name ? schedd_name : "local schedd",
pool_name ? pool_name : "local pool");
}
@@ -262,7 +262,7 @@ ClaimJobResult claim_job(classad::ClassAd const &ad, const char * pool_name, con
if( SpooledJobFiles::jobRequiresSpoolDirectory(&old_job_ad) ) {
if( !SpooledJobFiles::createJobSpoolDirectory(&old_job_ad,PRIV_USER) ) {
if( error_details ) {
- error_details->sprintf("Failed to create/chown source job spool directory to the user.");
+ error_details->formatstr("Failed to create/chown source job spool directory to the user.");
}
yield_job(ad,pool_name,schedd_name,true,cluster,proc,error_details,my_identity,false);
return CJR_ERROR;
@@ -293,7 +293,7 @@ bool yield_job(bool done, int cluster, int proc, classad::ClassAd const &job_ad,
}
if( ! is_managed ) {
if(error_details) {
- error_details->sprintf("Job %d.%d is not managed!", cluster, proc);
+ error_details->formatstr("Job %d.%d is not managed!", cluster, proc);
}
*keep_trying = false;
return false;
@@ -304,7 +304,7 @@ bool yield_job(bool done, int cluster, int proc, classad::ClassAd const &job_ad,
if( GetAttributeStringNew(cluster, proc, ATTR_JOB_MANAGED_MANAGER, &manager) >= 0) {
if(strcmp(manager, my_identity) != 0) {
if(error_details) {
- error_details->sprintf("Job %d.%d is managed by '%s' instead of expected '%s'", cluster, proc, manager, my_identity);
+ error_details->formatstr("Job %d.%d is managed by '%s' instead of expected '%s'", cluster, proc, manager, my_identity);
}
free(manager);
*keep_trying = false;
@@ -325,7 +325,7 @@ bool yield_job(bool done, int cluster, int proc, classad::ClassAd const &job_ad,
const char * newsetting = done ? MANAGED_DONE : MANAGED_SCHEDD;
if( SetAttributeString(cluster, proc, ATTR_JOB_MANAGED, newsetting) == -1 ) {
if(error_details) {
- error_details->sprintf("Encountered problem setting %s = %s", ATTR_JOB_MANAGED, newsetting);
+ error_details->formatstr("Encountered problem setting %s = %s", ATTR_JOB_MANAGED, newsetting);
}
return false;
}
@@ -394,7 +394,7 @@ static bool yield_job_with_current_privs(
if( ! DisconnectQ(qmgr, true /* commit */)) {
failobj.fail("Failed to commit job claim\n");
if(error_details && res) {
- error_details->sprintf("Failed to commit job claim for schedd %s in pool %s",
+ error_details->formatstr("Failed to commit job claim for schedd %s in pool %s",
schedd_name ? schedd_name : "local schedd",
pool_name ? pool_name : "local pool");
}
@@ -474,7 +474,7 @@ static bool submit_job_with_current_priv( ClassAd & src, const char * schedd_nam
// we want the job to hang around (taken from condor_submit.V6/submit.C)
MyString leaveinqueue;
- leaveinqueue.sprintf("%s == %d", ATTR_JOB_STATUS, COMPLETED);
+ leaveinqueue.formatstr("%s == %d", ATTR_JOB_STATUS, COMPLETED);
src.AssignExpr(ATTR_JOB_LEAVE_IN_QUEUE, leaveinqueue.Value());
ExprTree * tree;
@@ -622,7 +622,7 @@ static bool finalize_job_with_current_privs(classad::ClassAd const &job,int clus
}
MyString constraint;
- constraint.sprintf("(ClusterId==%d&&ProcId==%d)", cluster, proc);
+ constraint.formatstr("(ClusterId==%d&&ProcId==%d)", cluster, proc);
if( is_sandboxed ) {
@@ -682,12 +682,12 @@ static bool remove_job_with_current_privs(int cluster, int proc, char const *rea
if(!schedd_name) { schedd_name = "local schedd"; }
if(!pool_name) { pool_name = "local pool"; }
dprintf(D_ALWAYS, "Unable to find address of %s at %s\n", schedd_name, pool_name);
- error_desc.sprintf("Unable to find address of %s at %s", schedd_name, pool_name);
+ error_desc.formatstr("Unable to find address of %s at %s", schedd_name, pool_name);
return false;
}
MyString constraint;
- constraint.sprintf("(ClusterId==%d&&ProcId==%d)", cluster, proc);
+ constraint.formatstr("(ClusterId==%d&&ProcId==%d)", cluster, proc);
ClassAd *result_ad;
result_ad = schedd.removeJobs(constraint.Value(), reason, &errstack, AR_LONG);
diff --git a/src/condor_master.V6/master.cpp b/src/condor_master.V6/master.cpp
index b202ba2..1dc318a 100644
--- a/src/condor_master.V6/master.cpp
+++ b/src/condor_master.V6/master.cpp
@@ -257,7 +257,7 @@ main_init( int argc, char* argv[] )
// relative time. This means that we don't have to update
// the time each time we restart the daemon.
MyString runfor_env;
- runfor_env.sprintf("%s=%ld", EnvGetName(ENV_DAEMON_DEATHTIME),
+ runfor_env.formatstr("%s=%ld", EnvGetName(ENV_DAEMON_DEATHTIME),
time(NULL) + (runfor * 60));
SetEnv(runfor_env.Value());
}
@@ -1088,7 +1088,7 @@ invalidate_ads() {
}
ClassAd::EscapeStringValue( default_name, escaped_name );
- line.sprintf( "( TARGET.%s == \"%s\" )", ATTR_NAME, escaped_name.Value() );
+ line.formatstr( "( TARGET.%s == \"%s\" )", ATTR_NAME, escaped_name.Value() );
cmd_ad.AssignExpr( ATTR_REQUIREMENTS, line.Value() );
cmd_ad.Assign( ATTR_NAME, default_name );
cmd_ad.Assign( ATTR_MY_ADDRESS, daemonCore->publicNetworkIpAddr());
diff --git a/src/condor_master.V6/masterDaemon.cpp b/src/condor_master.V6/masterDaemon.cpp
index 2169257..b288e38 100644
--- a/src/condor_master.V6/masterDaemon.cpp
+++ b/src/condor_master.V6/masterDaemon.cpp
@@ -1071,7 +1071,7 @@ void
daemon::Exited( int status )
{
MyString msg;
- msg.sprintf( "The %s (pid %d) ", name_in_config_file, pid );
+ msg.formatstr( "The %s (pid %d) ", name_in_config_file, pid );
bool had_failure = true;
if (daemonCore->Was_Not_Responding(pid)) {
msg += "was killed because it was no longer responding";
@@ -1185,16 +1185,16 @@ daemon::Obituary( int status )
char buf[1000];
MyString email_subject;
- email_subject.sprintf("Problem %s: %s ", get_local_fqdn().Value(),
+ email_subject.formatstr("Problem %s: %s ", get_local_fqdn().Value(),
condor_basename(process_name));
if ( was_not_responding ) {
email_subject += "killed (unresponsive)";
} else {
MyString fmt;
if( WIFSIGNALED(status) ) {
- fmt.sprintf("died (%d)", WTERMSIG(status));
+ fmt.formatstr("died (%d)", WTERMSIG(status));
} else {
- fmt.sprintf("exited (%d)", WEXITSTATUS(status));
+ fmt.formatstr("exited (%d)", WEXITSTATUS(status));
}
email_subject += fmt;
}
@@ -1416,7 +1416,7 @@ daemon::SetupHighAvailability( void )
MyString name;
// Get the URL
- name.sprintf("HA_%s_LOCK_URL", name_in_config_file );
+ name.formatstr("HA_%s_LOCK_URL", name_in_config_file );
tmp = param( name.Value() );
if ( ! tmp ) {
tmp = param( "HA_LOCK_URL" );
@@ -1431,7 +1431,7 @@ daemon::SetupHighAvailability( void )
// Get the length of the lock
time_t lock_hold_time = 60 * 60; // One hour
- name.sprintf( "HA_%s_LOCK_HOLD_TIME", name_in_config_file );
+ name.formatstr( "HA_%s_LOCK_HOLD_TIME", name_in_config_file );
tmp = param( name.Value( ) );
if ( ! tmp ) {
tmp = param( "HA_LOCK_HOLD_TIME" );
@@ -1449,7 +1449,7 @@ daemon::SetupHighAvailability( void )
// Get the lock poll time
time_t poll_period = 5 * 60; // Five minutes
- name.sprintf( "HA_%s_POLL_PERIOD", name_in_config_file );
+ name.formatstr( "HA_%s_POLL_PERIOD", name_in_config_file );
tmp = param( name.Value() );
if ( ! tmp ) {
tmp = param( "HA_POLL_PERIOD" );
@@ -2217,7 +2217,7 @@ Daemons::ExecMaster()
runfor = 1; // minimum 1
}
MyString runfor_str;
- runfor_str.sprintf("%d",runfor);
+ runfor_str.formatstr("%d",runfor);
argv[i++] = strdup(runfor_str.Value());
}
}
diff --git a/src/condor_negotiator.V6/Accountant.cpp b/src/condor_negotiator.V6/Accountant.cpp
index 53e5f02..2dcb710 100644
--- a/src/condor_negotiator.V6/Accountant.cpp
+++ b/src/condor_negotiator.V6/Accountant.cpp
@@ -436,7 +436,7 @@ float Accountant::getGroupPriorityFactor(const MyString& CustomerName)
string GroupName = GetAssignedGroup(CustomerName)->name;
MyString groupPrioFactorConfig;
- groupPrioFactorConfig.sprintf("GROUP_PRIO_FACTOR_%s", GroupName.c_str());
+ groupPrioFactorConfig.formatstr("GROUP_PRIO_FACTOR_%s", GroupName.c_str());
double priorityFactor = param_double(groupPrioFactorConfig.Value(), 0.0);
return priorityFactor;
@@ -1028,11 +1028,11 @@ AttrList* Accountant::ReportState(const MyString& CustomerName, int* NumResource
MyString tmp;
ResourceName=key+ResourceRecord.Length();
- tmp.sprintf("Name%d = \"%s\"", ResourceNum, ResourceName.Value());
+ tmp.formatstr("Name%d = \"%s\"", ResourceNum, ResourceName.Value());
ad->Insert(tmp.Value());
if (ResourceAd->LookupInteger(StartTimeAttr,StartTime)==0) StartTime=0;
- tmp.sprintf("StartTime%d = %d", ResourceNum, StartTime);
+ tmp.formatstr("StartTime%d = %d", ResourceNum, StartTime);
ad->Insert(tmp.Value());
}
@@ -1516,7 +1516,7 @@ void Accountant::SetAttributeString(const MyString& Key, const MyString& AttrNam
}
MyString value;
- value.sprintf("\"%s\"",AttrValue.Value());
+ value.formatstr("\"%s\"",AttrValue.Value());
LogSetAttribute* log=new LogSetAttribute(Key.Value(),AttrName.Value(),value.Value());
AcctLog->AppendLog(log);
}
diff --git a/src/condor_negotiator.V6/matchmaker.cpp b/src/condor_negotiator.V6/matchmaker.cpp
index 064a8e4..c98861b 100644
--- a/src/condor_negotiator.V6/matchmaker.cpp
+++ b/src/condor_negotiator.V6/matchmaker.cpp
@@ -1713,13 +1713,13 @@ void Matchmaker::hgq_construct_tree() {
// group quota setting
MyString vname;
- vname.sprintf("GROUP_QUOTA_%s", gname.c_str());
+ vname.formatstr("GROUP_QUOTA_%s", gname.c_str());
double quota = param_double(vname.Value(), -1.0, 0, INT_MAX);
if (quota >= 0) {
group->config_quota = quota;
group->static_quota = true;
} else {
- vname.sprintf("GROUP_QUOTA_DYNAMIC_%s", gname.c_str());
+ vname.formatstr("GROUP_QUOTA_DYNAMIC_%s", gname.c_str());
quota = param_double(vname.Value(), -1.0, 0.0, 1.0);
if (quota >= 0) {
group->config_quota = quota;
@@ -1738,9 +1738,9 @@ void Matchmaker::hgq_construct_tree() {
}
// accept surplus
- vname.sprintf("GROUP_ACCEPT_SURPLUS_%s", gname.c_str());
+ vname.formatstr("GROUP_ACCEPT_SURPLUS_%s", gname.c_str());
group->accept_surplus = param_boolean(vname.Value(), default_accept_surplus);
- vname.sprintf("GROUP_AUTOREGROUP_%s", gname.c_str());
+ vname.formatstr("GROUP_AUTOREGROUP_%s", gname.c_str());
group->autoregroup = param_boolean(vname.Value(), default_autoregroup);
if (group->autoregroup) autoregroup = true;
if (group->accept_surplus) accept_surplus = true;
@@ -2488,7 +2488,7 @@ negotiateWithGroup ( int untrimmed_num_startds,
submitterAbsShare);
MyString starvation;
if( submitterLimitStarved > 0 ) {
- starvation.sprintf(" (starved %f)",submitterLimitStarved);
+ starvation.formatstr(" (starved %f)",submitterLimitStarved);
}
dprintf (D_FULLDEBUG, " submitterLimit = %f%s\n",
submitterLimit, starvation.Value());
@@ -2724,7 +2724,7 @@ obtainAdsFromCollector (
publicQuery.addORConstraint("(MyType == \"Scheduler\") || (MyType == \"Submitter\")");
if (strSlotConstraint && strSlotConstraint[0]) {
MyString machine;
- machine.sprintf("((MyType == \"Machine\") && (%s))", strSlotConstraint);
+ machine.formatstr("((MyType == \"Machine\") && (%s))", strSlotConstraint);
publicQuery.addORConstraint(machine.Value());
} else {
publicQuery.addORConstraint("(MyType == \"Machine\")");
@@ -3071,7 +3071,7 @@ negotiate(char const* groupName, char const *scheddName, const ClassAd *scheddAd
// Used for log messages to identify the schedd.
// Not for other uses, as it may change!
MyString schedd_id;
- schedd_id.sprintf("%s (%s)", scheddName, scheddAddr.Value());
+ schedd_id.formatstr("%s (%s)", scheddName, scheddAddr.Value());
// 0. connect to the schedd --- ask the cache for a connection
sock = sockCache->findReliSock( scheddAddr.Value() );
@@ -3491,7 +3491,7 @@ updateNegCycleEndTime(time_t startTime, ClassAd *submitter) {
endTime = time(NULL);
submitter->LookupInteger(ATTR_TOTAL_TIME_IN_CYCLE, oldTotalTime);
- buffer.sprintf("%s = %ld", ATTR_TOTAL_TIME_IN_CYCLE, (oldTotalTime +
+ buffer.formatstr("%s = %ld", ATTR_TOTAL_TIME_IN_CYCLE, (oldTotalTime +
(endTime - startTime)) );
submitter->InsertOrUpdate(buffer.Value());
}
@@ -4482,12 +4482,12 @@ addRemoteUserPrios( ClassAd *ad )
{
prio = (float) accountant.GetPriority( remoteUser.Value() );
ad->Assign(ATTR_REMOTE_USER_PRIO, prio);
- expr.sprintf("%s(\"%s\")",RESOURCES_IN_USE_BY_USER_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
+ expr.formatstr("%s(\"%s\")",RESOURCES_IN_USE_BY_USER_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
ad->AssignExpr(ATTR_REMOTE_USER_RESOURCES_IN_USE,expr.Value());
if (getGroupInfoFromUserId(remoteUser.Value(), temp_groupName, temp_groupQuota, temp_groupUsage)) {
// this is a group, so enter group usage info
ad->Assign(ATTR_REMOTE_GROUP, temp_groupName);
- expr.sprintf("%s(\"%s\")",RESOURCES_IN_USE_BY_USERS_GROUP_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
+ expr.formatstr("%s(\"%s\")",RESOURCES_IN_USE_BY_USERS_GROUP_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
ad->AssignExpr(ATTR_REMOTE_GROUP_RESOURCES_IN_USE,expr.Value());
ad->Assign(ATTR_REMOTE_GROUP_QUOTA,temp_groupQuota);
}
@@ -4515,11 +4515,11 @@ addRemoteUserPrios( ClassAd *ad )
}
// This won't fire if total_slots is still 0...
for(i = 1; i <= total_slots; i++) {
- slot_prefix.sprintf("%s%d_", resource_prefix, i);
- buffer.sprintf("%s%s", slot_prefix.Value(), ATTR_PREEMPTING_ACCOUNTING_GROUP);
- buffer1.sprintf("%s%s", slot_prefix.Value(), ATTR_PREEMPTING_USER);
- buffer2.sprintf("%s%s", slot_prefix.Value(), ATTR_ACCOUNTING_GROUP);
- buffer3.sprintf("%s%s", slot_prefix.Value(), ATTR_REMOTE_USER);
+ slot_prefix.formatstr("%s%d_", resource_prefix, i);
+ buffer.formatstr("%s%s", slot_prefix.Value(), ATTR_PREEMPTING_ACCOUNTING_GROUP);
+ buffer1.formatstr("%s%s", slot_prefix.Value(), ATTR_PREEMPTING_USER);
+ buffer2.formatstr("%s%s", slot_prefix.Value(), ATTR_ACCOUNTING_GROUP);
+ buffer3.formatstr("%s%s", slot_prefix.Value(), ATTR_REMOTE_USER);
// If there is a preempting user, use that for computing remote user prio.
if( ad->LookupString( buffer.Value() , remoteUser ) ||
ad->LookupString( buffer1.Value() , remoteUser ) ||
@@ -4529,21 +4529,21 @@ addRemoteUserPrios( ClassAd *ad )
// If there is a user on that VM, stick that user's priority
// information into the ad
prio = (float) accountant.GetPriority( remoteUser.Value() );
- buffer.sprintf("%s%s", slot_prefix.Value(),
+ buffer.formatstr("%s%s", slot_prefix.Value(),
ATTR_REMOTE_USER_PRIO);
ad->Assign(buffer.Value(),prio);
- buffer.sprintf("%s%s", slot_prefix.Value(),
+ buffer.formatstr("%s%s", slot_prefix.Value(),
ATTR_REMOTE_USER_RESOURCES_IN_USE);
- expr.sprintf("%s(\"%s\")",RESOURCES_IN_USE_BY_USER_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
+ expr.formatstr("%s(\"%s\")",RESOURCES_IN_USE_BY_USER_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
ad->AssignExpr(buffer.Value(),expr.Value());
if (getGroupInfoFromUserId(remoteUser.Value(), temp_groupName, temp_groupQuota, temp_groupUsage)) {
// this is a group, so enter group usage info
- buffer.sprintf("%s%s", slot_prefix.Value(), ATTR_REMOTE_GROUP);
+ buffer.formatstr("%s%s", slot_prefix.Value(), ATTR_REMOTE_GROUP);
ad->Assign( buffer.Value(), temp_groupName );
- buffer.sprintf("%s%s", slot_prefix.Value(), ATTR_REMOTE_GROUP_RESOURCES_IN_USE);
- expr.sprintf("%s(\"%s\")",RESOURCES_IN_USE_BY_USERS_GROUP_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
+ buffer.formatstr("%s%s", slot_prefix.Value(), ATTR_REMOTE_GROUP_RESOURCES_IN_USE);
+ expr.formatstr("%s(\"%s\")",RESOURCES_IN_USE_BY_USERS_GROUP_FN_NAME,ClassAd::EscapeStringValue(remoteUser.Value(),expr_buffer));
ad->AssignExpr( buffer.Value(), expr.Value() );
- buffer.sprintf("%s%s", slot_prefix.Value(), ATTR_REMOTE_GROUP_QUOTA);
+ buffer.formatstr("%s%s", slot_prefix.Value(), ATTR_REMOTE_GROUP_QUOTA);
ad->Assign( buffer.Value(), temp_groupQuota );
}
}
@@ -4899,12 +4899,12 @@ init_public_ad()
}
publicAd->Assign(ATTR_NAME, NegotiatorName );
- line.sprintf ("%s = \"%s\"", ATTR_NEGOTIATOR_IP_ADDR,
+ line.formatstr ("%s = \"%s\"", ATTR_NEGOTIATOR_IP_ADDR,
daemonCore->InfoCommandSinfulString() );
publicAd->Insert(line.Value());
#if !defined(WIN32)
- line.sprintf("%s = %d", ATTR_REAL_UID, (int)getuid() );
+ line.formatstr("%s = %d", ATTR_REAL_UID, (int)getuid() );
publicAd->Insert(line.Value());
#endif
@@ -4958,7 +4958,7 @@ Matchmaker::invalidateNegotiatorAd( void )
cmd_ad.SetMyTypeName( QUERY_ADTYPE );
cmd_ad.SetTargetTypeName( NEGOTIATOR_ADTYPE );
- line.sprintf( "%s = TARGET.%s == \"%s\"", ATTR_REQUIREMENTS,
+ line.formatstr( "%s = TARGET.%s == \"%s\"", ATTR_REQUIREMENTS,
ATTR_NAME,
NegotiatorName );
cmd_ad.Insert( line.Value() );
@@ -5136,7 +5136,7 @@ void Matchmaker::RegisterAttemptedOfflineMatch( ClassAd *job_ad, ClassAd *startd
// figure out the prefix
int prefix_len = strcspn(name.Value(),"0123456789");
if( prefix_len < at - name.Value() ) {
- slot1_name.sprintf("%.*s1%s",prefix_len,name.Value(),at);
+ slot1_name.formatstr("%.*s1%s",prefix_len,name.Value(),at);
}
}
}
@@ -5147,7 +5147,7 @@ void Matchmaker::RegisterAttemptedOfflineMatch( ClassAd *job_ad, ClassAd *startd
slot1_update_ad.Assign(ATTR_NAME,slot1_name);
slot1_update_ad.CopyAttribute(ATTR_STARTD_IP_ADDR,ATTR_STARTD_IP_ADDR,startd_ad);
MyString slotX_last_match_time;
- slotX_last_match_time.sprintf("slot%d_%s",slot_id,ATTR_MACHINE_LAST_MATCH_TIME);
+ slotX_last_match_time.formatstr("slot%d_%s",slot_id,ATTR_MACHINE_LAST_MATCH_TIME);
slot1_update_ad.Assign(slotX_last_match_time.Value(),(int)now);
classy_counted_ptr<ClassAdMsg> lmsg = \
@@ -5190,7 +5190,7 @@ static void
DelAttrN( ClassAd *ad, char const *attr, int n )
{
MyString attrn;
- attrn.sprintf("%s%d",attr,n);
+ attrn.formatstr("%s%d",attr,n);
ad->Delete( attrn.Value() );
}
@@ -5198,7 +5198,7 @@ static void
SetAttrN( ClassAd *ad, char const *attr, int n, int value )
{
MyString attrn;
- attrn.sprintf("%s%d",attr,n);
+ attrn.formatstr("%s%d",attr,n);
ad->Assign(attrn.Value(),value);
}
@@ -5206,7 +5206,7 @@ static void
SetAttrN( ClassAd *ad, char const *attr, int n, double value )
{
MyString attrn;
- attrn.sprintf("%s%d",attr,n);
+ attrn.formatstr("%s%d",attr,n);
ad->Assign(attrn.Value(),value);
}
@@ -5214,7 +5214,7 @@ static void
SetAttrN( ClassAd *ad, char const *attr, int n, std::set<std::string> &string_list )
{
MyString attrn;
- attrn.sprintf("%s%d",attr,n);
+ attrn.formatstr("%s%d",attr,n);
MyString value;
std::set<std::string>::iterator it;
diff --git a/src/condor_privsep/privsep_client.UNIX.cpp b/src/condor_privsep/privsep_client.UNIX.cpp
index 7bde01f..b6e3547 100644
--- a/src/condor_privsep/privsep_client.UNIX.cpp
+++ b/src/condor_privsep/privsep_client.UNIX.cpp
@@ -233,7 +233,7 @@ privsep_launch_switchboard(const char* op, FILE*& in_fp, FILE*& err_fp)
// went wrong before exiting
//
MyString err;
- err.sprintf("exec error on %s: %s (%d)\n",
+ err.formatstr("exec error on %s: %s (%d)\n",
cmd.Value(),
strerror(errno),
errno);
diff --git a/src/condor_q.V6/queue.cpp b/src/condor_q.V6/queue.cpp
index e320816..ddd9f34 100644
--- a/src/condor_q.V6/queue.cpp
+++ b/src/condor_q.V6/queue.cpp
@@ -1335,7 +1335,7 @@ processCommandLineArguments (int argc, char *argv[])
opts = FormatOptionAutoWidth | FormatOptionNoTruncate;
mask_head.Append(hd);
}
- else if (flabel) { lbl.sprintf("%s = ", argv[i]); wid = 0; opts = 0; }
+ else if (flabel) { lbl.formatstr("%s = ", argv[i]); wid = 0; opts = 0; }
lbl += fCapV ? "%V" : "%v";
mask.registerFormat(lbl.Value(), wid, opts, argv[i]);
}
@@ -1686,9 +1686,9 @@ bufferJobShort( ClassAd *ad ) {
MyString args_string;
ArgList::GetArgsStringForDisplay(ad,&args_string);
if (!args_string.IsEmpty()) {
- buffer.sprintf( "%s %s", condor_basename(cmd), args_string.Value() );
+ buffer.formatstr( "%s %s", condor_basename(cmd), args_string.Value() );
} else {
- buffer.sprintf( "%s", condor_basename(cmd) );
+ buffer.formatstr( "%s", condor_basename(cmd) );
}
free(cmd);
utime = job_time(utime,ad);
diff --git a/src/condor_rm.V6/rm.cpp b/src/condor_rm.V6/rm.cpp
index a4b5d2f..6b1ac6a 100644
--- a/src/condor_rm.V6/rm.cpp
+++ b/src/condor_rm.V6/rm.cpp
@@ -620,7 +620,7 @@ procArg(const char* arg)
// delete the cluster
{
CondorError errstack;
- constraint.sprintf( "%s == %d", ATTR_CLUSTER_ID, c );
+ constraint.formatstr( "%s == %d", ATTR_CLUSTER_ID, c );
if( doWorkByConstraint(constraint.Value(), &errstack) ) {
fprintf( stdout,
"Cluster %d %s.\n", c,
@@ -665,7 +665,7 @@ procArg(const char* arg)
// process by user name
else {
CondorError errstack;
- constraint.sprintf("%s == \"%s\"", ATTR_OWNER, arg );
+ constraint.formatstr("%s == \"%s\"", ATTR_OWNER, arg );
if( doWorkByConstraint(constraint.Value(), &errstack) ) {
fprintf( stdout, "User %s's job(s) %s.\n", arg,
(mode == JA_REMOVE_JOBS) ?
diff --git a/src/condor_schedd.V6/dedicated_scheduler.cpp b/src/condor_schedd.V6/dedicated_scheduler.cpp
index b5c5d12..1f95282 100644
--- a/src/condor_schedd.V6/dedicated_scheduler.cpp
+++ b/src/condor_schedd.V6/dedicated_scheduler.cpp
@@ -1520,7 +1520,7 @@ DedicatedScheduler::getDedicatedResourceInfo( void )
// Make a new list to hold our resource classads.
resources = new ClassAdList;
- constraint.sprintf("DedicatedScheduler == \"%s\"", name());
+ constraint.formatstr("DedicatedScheduler == \"%s\"", name());
query.addORConstraint( constraint.Value() );
// This should fill in resources with all the classads we care
@@ -3250,7 +3250,7 @@ DedicatedScheduler::makeGenericAdFromJobAd(ClassAd *job)
// >= the duration of the job...
MyString buf;
- buf.sprintf( "%s = (Target.DedicatedScheduler == \"%s\") && "
+ buf.formatstr( "%s = (Target.DedicatedScheduler == \"%s\") && "
"(Target.RemoteOwner =!= \"%s\") && (%s)",
ATTR_REQUIREMENTS, name(), name(), rhs );
req->InsertOrUpdate( buf.Value() );
@@ -3321,7 +3321,7 @@ DedicatedScheduler::printSatisfaction( int cluster, CAList* idle,
CAList* busy )
{
MyString msg;
- msg.sprintf( "Satisfied job %d with ", cluster );
+ msg.formatstr( "Satisfied job %d with ", cluster );
bool had_one = false;
if( idle && idle->Length() ) {
msg += idle->Length();
diff --git a/src/condor_schedd.V6/grid_universe.cpp b/src/condor_schedd.V6/grid_universe.cpp
index d6dadba..9a15715 100644
--- a/src/condor_schedd.V6/grid_universe.cpp
+++ b/src/condor_schedd.V6/grid_universe.cpp
@@ -228,7 +228,7 @@ char *
GridUniverseLogic::scratchFilePath(gman_node_t *gman_node)
{
MyString filename;
- filename.sprintf("%s%p.%d",scratch_prefix,
+ filename.formatstr("%s%p.%d",scratch_prefix,
gman_node,daemonCore->getpid());
char *prefix = temp_dir_path();
ASSERT(prefix);
@@ -267,10 +267,10 @@ GridUniverseLogic::GManagerReaper(Service *,int pid, int exit_status)
if(gman_node) { owner_safe = owner; }
else { owner_safe = "Unknown"; }
if ( WIFEXITED( exit_status ) ) {
- exit_reason.sprintf( "with return code %d",
+ exit_reason.formatstr( "with return code %d",
WEXITSTATUS( exit_status ) );
} else {
- exit_reason.sprintf( "due to %s",
+ exit_reason.formatstr( "due to %s",
daemonCore->GetExceptionString( exit_status ) );
}
dprintf(D_ALWAYS, "condor_gridmanager (PID %d, owner %s) exited %s.\n",
@@ -469,11 +469,11 @@ GridUniverseLogic::StartOrFindGManager(const char* owner, const char* domain,
}
MyString constraint;
if ( !attr_name ) {
- constraint.sprintf("(%s=?=\"%s\"&&%s==%d)",
+ constraint.formatstr("(%s=?=\"%s\"&&%s==%d)",
ATTR_OWNER,owner,
ATTR_JOB_UNIVERSE,CONDOR_UNIVERSE_GRID);
} else {
- constraint.sprintf("(%s=?=\"%s\"&&%s=?=\"%s\"&&%s==%d)",
+ constraint.formatstr("(%s=?=\"%s\"&&%s=?=\"%s\"&&%s==%d)",
ATTR_OWNER,owner,
attr_name,attr_value,
ATTR_JOB_UNIVERSE,CONDOR_UNIVERSE_GRID);
diff --git a/src/condor_schedd.V6/qmgmt.cpp b/src/condor_schedd.V6/qmgmt.cpp
index e5e46c6..103b613 100644
--- a/src/condor_schedd.V6/qmgmt.cpp
+++ b/src/condor_schedd.V6/qmgmt.cpp
@@ -883,7 +883,7 @@ InitJobQueue(const char *job_queue_name,int max_historical_logs)
// all jobs, we only have to figure it out once. We use '%'
// as the delimiter, since ATTR_NAME might already have '@' in
// it, and we don't want to confuse things any further.
- correct_scheduler.sprintf( "DedicatedScheduler@%s", Name );
+ correct_scheduler.formatstr( "DedicatedScheduler@%s", Name );
next_cluster_num = cluster_initial_val;
JobQueue->StartIterateAllClassAds();
@@ -958,7 +958,7 @@ InitJobQueue(const char *job_queue_name,int max_historical_logs)
// Figure out what ATTR_USER *should* be for this job
int nice_user = 0;
ad->LookupInteger( ATTR_NICE_USER, nice_user );
- correct_user.sprintf( "%s%s@%s",
+ correct_user.formatstr( "%s%s@%s",
(nice_user) ? "nice-user." : "", owner.Value(),
scheduler.uidDomain() );
@@ -2134,7 +2134,7 @@ SetAttribute(int cluster_id, int proc_id, const char *attr_name,
// just fill in the value of Owner with the owner name
// of the authenticated socket.
if ( sock_owner && *sock_owner ) {
- new_value.sprintf("\"%s\"",sock_owner);
+ new_value.formatstr("\"%s\"",sock_owner);
attr_value = new_value.Value();
} else {
// socket not authenticated and Owner is UNDEFINED.
@@ -2215,7 +2215,7 @@ SetAttribute(int cluster_id, int proc_id, const char *attr_name,
GetAttributeInt( cluster_id, proc_id, ATTR_NICE_USER,
&nice_user );
- user.sprintf( "\"%s%s@%s\"", (nice_user) ? "nice-user." : "",
+ user.formatstr( "\"%s%s@%s\"", (nice_user) ? "nice-user." : "",
owner, scheduler.uidDomain() );
SetAttribute( cluster_id, proc_id, ATTR_USER, user.Value(), flags );
@@ -2245,7 +2245,7 @@ SetAttribute(int cluster_id, int proc_id, const char *attr_name,
}
if( GetAttributeString(cluster_id, proc_id, ATTR_OWNER, owner)
>= 0 ) {
- user.sprintf( "\"%s%s@%s\"", (nice_user) ? "nice-user." :
+ user.formatstr( "\"%s%s@%s\"", (nice_user) ? "nice-user." :
"", owner.Value(), scheduler.uidDomain() );
SetAttribute( cluster_id, proc_id, ATTR_USER, user.Value(), flags );
}
@@ -2391,10 +2391,10 @@ SetAttribute(int cluster_id, int proc_id, const char *attr_name,
fvalue = ceil( fvalue/roundto )*roundto;
if( attr_type == classad::Value::INTEGER_VALUE ) {
- new_value.sprintf("%d",(int)fvalue);
+ new_value.formatstr("%d",(int)fvalue);
}
else {
- new_value.sprintf("%f",fvalue);
+ new_value.formatstr("%f",fvalue);
}
}
}
@@ -2587,7 +2587,7 @@ SetMyProxyPassword (int cluster_id, int proc_id, const char *pwd) {
// Create filename
MyString filename;
- filename.sprintf( "%s/mpp.%d.%d", Spool, cluster_id, proc_id);
+ filename.formatstr( "%s/mpp.%d.%d", Spool, cluster_id, proc_id);
// Swith to root temporarily
priv_state old_priv = set_root_priv();
@@ -2646,7 +2646,7 @@ DestroyMyProxyPassword( int cluster_id, int proc_id )
}
MyString filename;
- filename.sprintf( "%s%cmpp.%d.%d", Spool, DIR_DELIM_CHAR,
+ filename.formatstr( "%s%cmpp.%d.%d", Spool, DIR_DELIM_CHAR,
cluster_id, proc_id );
// Swith to root temporarily
@@ -2687,7 +2687,7 @@ int GetMyProxyPassword (int cluster_id, int proc_id, char ** value) {
priv_state old_priv = set_root_priv();
MyString filename;
- filename.sprintf( "%s/mpp.%d.%d", Spool, cluster_id, proc_id);
+ filename.formatstr( "%s/mpp.%d.%d", Spool, cluster_id, proc_id);
int fd = safe_open_wrapper_follow(filename.Value(), O_RDONLY);
if (fd < 0) {
set_priv(old_priv);
@@ -3385,7 +3385,7 @@ dollarDollarExpand(int cluster_id, int proc_id, ClassAd *ad, ClassAd *startd_ad,
// This is a classad expression to be considered
MyString expr_to_add;
- expr_to_add.sprintf("string(%s", name + 1);
+ expr_to_add.formatstr("string(%s", name + 1);
expr_to_add.setChar(expr_to_add.Length()-1, ')');
// Any backwacked double quotes or backwacks
@@ -3629,7 +3629,7 @@ dollarDollarExpand(int cluster_id, int proc_id, ClassAd *ad, ClassAd *startd_ad,
// Don't put the $$(expr) literally in the hold message, otherwise
// if we fix the original problem, we won't be able to expand the one
// in the hold message
- hold_reason.sprintf("Cannot expand $$ expression (%s).",name);
+ hold_reason.formatstr("Cannot expand $$ expression (%s).",name);
// no ClassAd in the match record; probably
// an older negotiator. put the job on hold and send email.
@@ -3687,7 +3687,7 @@ dollarDollarExpand(int cluster_id, int proc_id, ClassAd *ad, ClassAd *startd_ad,
{
attribute_not_found = true;
MyString hold_reason;
- hold_reason.sprintf(
+ hold_reason.formatstr(
"Failed to convert environment to target syntax"
" for starter (opsys=%s): %s",
opsys ? opsys : "NULL",env_error_msg.Value());
@@ -3720,7 +3720,7 @@ dollarDollarExpand(int cluster_id, int proc_id, ClassAd *ad, ClassAd *startd_ad,
{
attribute_not_found = true;
MyString hold_reason;
- hold_reason.sprintf(
+ hold_reason.formatstr(
"Failed to convert arguments to target syntax"
" for starter: %s",
arg_error_msg.Value());
diff --git a/src/condor_schedd.V6/qmgr_job_updater.cpp b/src/condor_schedd.V6/qmgr_job_updater.cpp
index f9c100a..1322873 100644
--- a/src/condor_schedd.V6/qmgr_job_updater.cpp
+++ b/src/condor_schedd.V6/qmgr_job_updater.cpp
@@ -277,7 +277,7 @@ bool
QmgrJobUpdater::updateAttr( const char *name, int value, bool updateMaster, bool log )
{
MyString buf;
- buf.sprintf("%d", value);
+ buf.formatstr("%d", value);
return updateAttr(name, buf.Value(), updateMaster, log);
}
diff --git a/src/condor_schedd.V6/schedd.cpp b/src/condor_schedd.V6/schedd.cpp
index ff87256..5093aec 100644
--- a/src/condor_schedd.V6/schedd.cpp
+++ b/src/condor_schedd.V6/schedd.cpp
@@ -1046,7 +1046,7 @@ Scheduler::count_jobs()
pAd.Assign(ATTR_FLOCKED_JOBS, Owners[i].JobsFlocked);
dprintf (D_FULLDEBUG, "Changed attribute: %s = %d\n", ATTR_FLOCKED_JOBS, Owners[i].JobsFlocked);
- submitter_name.sprintf("%s@%s", Owners[i].Name, UidDomain);
+ submitter_name.formatstr("%s@%s", Owners[i].Name, UidDomain);
pAd.Assign(ATTR_NAME, submitter_name.Value());
dprintf (D_FULLDEBUG, "Changed attribute: %s = %s@%s\n", ATTR_NAME, Owners[i].Name, UidDomain);
@@ -1120,7 +1120,7 @@ Scheduler::count_jobs()
pAd.Assign(ATTR_RUNNING_JOBS, Owners[i].JobsRunning);
pAd.Assign(ATTR_FLOCKED_JOBS, Owners[i].JobsFlocked);
- submitter_name.sprintf("%s@%s", Owners[i].Name, UidDomain);
+ submitter_name.formatstr("%s@%s", Owners[i].Name, UidDomain);
pAd.Assign(ATTR_NAME, submitter_name.Value());
// we will use this "tag" later to identify which
@@ -1174,7 +1174,7 @@ Scheduler::count_jobs()
// In case we want to update this ad, we have to build the submitter
// name string that we will be assigning with before we free the owner name.
- submitter_name.sprintf("%s@%s", OldOwners[i].Name, UidDomain);
+ submitter_name.formatstr("%s@%s", OldOwners[i].Name, UidDomain);
// Now that we've finished using OldOwners[i].Name, we can
// free it.
@@ -1308,7 +1308,7 @@ int Scheduler::make_ad_list(
for (int ii = 0; ii < N_Owners; ++ii) {
cad = new ClassAd();
cad->ChainToAd(m_adBase);
- submitter_name.sprintf("%s@%s", Owners[ii].Name, UidDomain);
+ submitter_name.formatstr("%s@%s", Owners[ii].Name, UidDomain);
cad->Assign(ATTR_NAME, submitter_name.Value());
cad->Assign(ATTR_SUBMITTER_TAG,HOME_POOL_SUBMITTER_TAG);
@@ -1505,7 +1505,7 @@ count( ClassAd *job )
// check if this job is being submitted by a NiceUser, and
// if so, insert it as a new entry in the "Owner" table
if( job->LookupInteger( ATTR_NICE_USER, niceUser ) && niceUser ) {
- owner_buf2.sprintf("%s.%s",NiceUserName,owner);
+ owner_buf2.formatstr("%s.%s",NiceUserName,owner);
owner=owner_buf2.Value();
}
@@ -1975,7 +1975,7 @@ abort_job_myself( PROC_ID job_id, JobAction action, bool log_hold,
#ifdef WIN32
msg.sprintf("Bad or missing credential for user: %s", owner.Value());
#else
- msg.sprintf("Unable to switch to user: %s", owner.Value());
+ msg.formatstr("Unable to switch to user: %s", owner.Value());
#endif
holdJob(job_id.cluster, job_id.proc, msg.Value(),
CONDOR_HOLD_CODE_FailedToAccessUserAccount, 0,
@@ -2497,7 +2497,7 @@ jobIsFinished( int cluster, int proc, void* )
priv = set_user_priv();
- filename_template.sprintf( "%s/.condor_nfs_sync_XXXXXX",
+ filename_template.formatstr( "%s/.condor_nfs_sync_XXXXXX",
iwd.Value() );
sync_filename = strdup( filename_template.Value() );
sync_fd = condor_mkstemp( sync_filename );
@@ -4534,7 +4534,7 @@ removeOtherJobs( int cluster, int proc )
ATTR_OTHER_JOB_REMOVE_REQUIREMENTS,
removeConstraint.Value(), cluster, proc );
MyString reason;
- reason.sprintf(
+ reason.formatstr(
"removed because <%s = %s> fired when job (%d.%d)"
" was removed", ATTR_OTHER_JOB_REMOVE_REQUIREMENTS,
removeConstraint.Value(), cluster, proc );
@@ -5408,7 +5408,7 @@ Scheduler::contactStartd( ContactStartdArgs* args )
}
MyString description;
- description.sprintf( "%s %d.%d", mrec->description(),
+ description.formatstr( "%s %d.%d", mrec->description(),
mrec->cluster, mrec->proc );
int cluster = mrec->cluster;
@@ -5554,7 +5554,7 @@ Scheduler::claimedStartd( DCMsgCallback *cb ) {
match->auth_hole_id = new MyString;
ASSERT(match->auth_hole_id != NULL);
if (msg->startd_fqu() && *msg->startd_fqu()) {
- match->auth_hole_id->sprintf("%s/%s",
+ match->auth_hole_id->formatstr("%s/%s",
msg->startd_fqu(),
msg->startd_ip_addr());
}
@@ -6784,7 +6784,7 @@ Scheduler::spawnShadow( shadow_rec* srec )
if ( sh_reads_file ) {
if( sh_is_dc ) {
- argbuf.sprintf("%d.%d",job_id->cluster,job_id->proc);
+ argbuf.formatstr("%d.%d",job_id->cluster,job_id->proc);
args.AppendArg(argbuf.Value());
if(wants_reconnect) {
@@ -6794,11 +6794,11 @@ Scheduler::spawnShadow( shadow_rec* srec )
// pass the public ip/port of the schedd (used w/ reconnect)
// We need this even if we are not currently in reconnect mode,
// because the shadow may go into reconnect mode at any time.
- argbuf.sprintf("--schedd=%s", daemonCore->publicNetworkIpAddr());
+ argbuf.formatstr("--schedd=%s", daemonCore->publicNetworkIpAddr());
args.AppendArg(argbuf.Value());
if( m_have_xfer_queue_contact ) {
- argbuf.sprintf("--xfer-queue=%s", m_xfer_queue_contact.c_str());
+ argbuf.formatstr("--xfer-queue=%s", m_xfer_queue_contact.c_str());
args.AppendArg(argbuf.Value());
}
@@ -6991,7 +6991,7 @@ Scheduler::spawnJobHandlerRaw( shadow_rec* srec, const char* path,
p->getUseridMap(usermap);
if( !usermap.IsEmpty() ) {
MyString envname;
- envname.sprintf("_%s_USERID_MAP",myDistro->Get());
+ envname.formatstr("_%s_USERID_MAP",myDistro->Get());
extra_env.SetEnv(envname.Value(),usermap.Value());
}
}
@@ -7373,7 +7373,7 @@ Scheduler::spawnLocalStarter( shadow_rec* srec )
starter_args.AppendArg("-header");
MyString header;
- header.sprintf("(%d.%d) ",job_id->cluster,job_id->proc);
+ header.formatstr("(%d.%d) ",job_id->cluster,job_id->proc);
starter_args.AppendArg(header.Value());
starter_args.AppendArg("-job-input-ad");
@@ -7405,7 +7405,7 @@ Scheduler::spawnLocalStarter( shadow_rec* srec )
Env starter_env;
MyString execute_env;
- execute_env.sprintf( "_%s_EXECUTE", myDistro->Get());
+ execute_env.formatstr( "_%s_EXECUTE", myDistro->Get());
starter_env.SetEnv(execute_env.Value(),LocalUnivExecuteDir);
rval = spawnJobHandlerRaw( srec, starter_path, starter_args,
@@ -7451,7 +7451,7 @@ Scheduler::initLocalStarterDir( void )
// If you change this default, make sure you change
// condor_preen, too, so that it doesn't nuke your
// directory (assuming you still use SPOOL).
- dir_name.sprintf( "%s%c%s", tmp, DIR_DELIM_CHAR,
+ dir_name.formatstr( "%s%c%s", tmp, DIR_DELIM_CHAR,
"local_univ_execute" );
} else {
dir_name = tmp;
@@ -7586,7 +7586,7 @@ Scheduler::start_sched_universe_job(PROC_ID* job_id)
#ifdef WIN32
tmpstr.sprintf("Bad or missing credential for user: %s", owner.Value());
#else
- tmpstr.sprintf("Unable to switch to user: %s", owner.Value());
+ tmpstr.formatstr("Unable to switch to user: %s", owner.Value());
#endif
holdJob(job_id->cluster, job_id->proc, tmpstr.Value(),
CONDOR_HOLD_CODE_FailedToAccessUserAccount, 0,
@@ -7664,7 +7664,7 @@ Scheduler::start_sched_universe_job(PROC_ID* job_id)
}
if ( !is_executable ) {
MyString tmpstr;
- tmpstr.sprintf( "File '%s' is missing or not executable", a_out_name.Value() );
+ tmpstr.formatstr( "File '%s' is missing or not executable", a_out_name.Value() );
set_priv( priv ); // back to regular privs...
holdJob(job_id->cluster, job_id->proc, tmpstr.Value(),
CONDOR_HOLD_CODE_FailedToCreateProcess, EACCES,
@@ -7788,7 +7788,7 @@ Scheduler::start_sched_universe_job(PROC_ID* job_id)
// Don't use a_out_name for argv[0], use
// "condor_scheduniv_exec.cluster.proc" instead.
- argbuf.sprintf("condor_scheduniv_exec.%d.%d",job_id->cluster,job_id->proc);
+ argbuf.formatstr("condor_scheduniv_exec.%d.%d",job_id->cluster,job_id->proc);
args.AppendArg(argbuf.Value());
if(!args.AppendArgsFromClassAd(userJob,&error_msg)) {
@@ -8063,11 +8063,11 @@ RotateAttributeList( int cluster, int proc, char const *attrname, int start_inde
index--)
{
MyString attr;
- attr.sprintf("%s%d",attrname,index-1);
+ attr.formatstr("%s%d",attrname,index-1);
char *value=NULL;
if( GetAttributeExprNew(cluster,proc,attr.Value(),&value) == 0 ) {
- attr.sprintf("%s%d",attrname,index);
+ attr.formatstr("%s%d",attrname,index);
SetAttribute(cluster,proc,attr.Value(),value);
free( value );
}
@@ -8153,7 +8153,7 @@ Scheduler::InsertMachineAttrs( int cluster, int proc, ClassAd *machine_ad )
char const *attr;
while( (attr=machine_attrs.next()) != NULL ) {
MyString result_attr;
- result_attr.sprintf("%s%s",ATTR_MACHINE_ATTR_PREFIX,attr);
+ result_attr.formatstr("%s%s",ATTR_MACHINE_ATTR_PREFIX,attr);
RotateAttributeList(cluster,proc,result_attr.Value(),0,history_len);
@@ -10079,21 +10079,21 @@ Scheduler::Init()
// set defaults for rounding attributes for autoclustering
// only set these values if nothing is specified in condor_config.
MyString tmpstr;
- tmpstr.sprintf("SCHEDD_ROUND_ATTR_%s",ATTR_EXECUTABLE_SIZE);
+ tmpstr.formatstr("SCHEDD_ROUND_ATTR_%s",ATTR_EXECUTABLE_SIZE);
tmp = param(tmpstr.Value());
if ( !tmp ) {
config_insert(tmpstr.Value(),"25%"); // round up to 25% of magnitude
} else {
free(tmp);
}
- tmpstr.sprintf("SCHEDD_ROUND_ATTR_%s",ATTR_IMAGE_SIZE);
+ tmpstr.formatstr("SCHEDD_ROUND_ATTR_%s",ATTR_IMAGE_SIZE);
tmp = param(tmpstr.Value());
if ( !tmp ) {
config_insert(tmpstr.Value(),"25%"); // round up to 25% of magnitude
} else {
free(tmp);
}
- tmpstr.sprintf("SCHEDD_ROUND_ATTR_%s",ATTR_DISK_USAGE);
+ tmpstr.formatstr("SCHEDD_ROUND_ATTR_%s",ATTR_DISK_USAGE);
tmp = param(tmpstr.Value());
if ( !tmp ) {
config_insert(tmpstr.Value(),"25%"); // round up to 25% of magnitude
@@ -10104,7 +10104,7 @@ Scheduler::Init()
// in the startd for ATTR_IS_VALID_CHECKPOINT_PLATFORM references
// it (thus by default it is significant), and further references it
// essentially as a bool. so by default, lets round it.
- tmpstr.sprintf("SCHEDD_ROUND_ATTR_%s",ATTR_NUM_CKPTS);
+ tmpstr.formatstr("SCHEDD_ROUND_ATTR_%s",ATTR_NUM_CKPTS);
tmp = param(tmpstr.Value());
if ( !tmp ) {
config_insert(tmpstr.Value(),"4"); // round up to next 10000
@@ -10454,7 +10454,7 @@ Scheduler::Init()
MyString other = groups[2]; // this will be lowercase
if (isdigit(other[0])) {
// can't start atributes with a digit, start with _ instead
- other.sprintf("_%s", groups[2].Value());
+ other.formatstr("_%s", groups[2].Value());
} else {
other.setChar(0, toupper(other[0])); // capitalize it.
}
@@ -10465,7 +10465,7 @@ Scheduler::Init()
bool by = (MATCH == strcasecmp(byorfor.Value(), "by"));
if (by) {
MyString expires_name;
- expires_name.sprintf("schedd_expire_stats_by_%s", other.Value());
+ expires_name.formatstr("schedd_expire_stats_by_%s", other.Value());
lifetime = (time_t)param_integer(expires_name.Value(), one_week);
}
@@ -10744,7 +10744,7 @@ Scheduler::Init()
}
if ( expr ) {
MyString temp;
- temp.sprintf("string(%s)",expr);
+ temp.formatstr("string(%s)",expr);
free(expr);
expr = temp.StrDup();
ParseClassAdRvalExpr(temp.Value(),m_parsed_gridman_selection_expr);
@@ -11303,7 +11303,7 @@ Scheduler::invalidate_ads()
cad->SetTargetTypeName( SCHEDD_ADTYPE );
// Invalidate the schedd ad
- line.sprintf( "%s = TARGET.%s == \"%s\"", ATTR_REQUIREMENTS, ATTR_NAME, Name );
+ line.formatstr( "%s = TARGET.%s == \"%s\"", ATTR_REQUIREMENTS, ATTR_NAME, Name );
cad->Insert( line.Value() );
cad->Assign( ATTR_NAME, Name );
cad->Assign( ATTR_MY_ADDRESS, daemonCore->publicNetworkIpAddr() );
@@ -11322,10 +11322,10 @@ Scheduler::invalidate_ads()
for( i=0; i<N_Owners; i++ ) {
daemonCore->sendUpdates(INVALIDATE_SUBMITTOR_ADS, cad, NULL, false);
MyString owner;
- owner.sprintf("%s@%s", Owners[i].Name, UidDomain);
+ owner.formatstr("%s@%s", Owners[i].Name, UidDomain);
cad->Assign( ATTR_NAME, owner.Value() );
- line.sprintf( "%s = TARGET.%s == \"%s\" && TARGET.%s == \"%s\"",
+ line.formatstr( "%s = TARGET.%s == \"%s\" && TARGET.%s == \"%s\"",
ATTR_REQUIREMENTS,
ATTR_SCHEDD_NAME, Name,
ATTR_NAME, owner.Value() );
@@ -12122,7 +12122,7 @@ Scheduler::get_job_connect_info_handler_implementation(int, Stream* s) {
if( !input.LookupInteger(ATTR_CLUSTER_ID,jobid.cluster) ||
!input.LookupInteger(ATTR_PROC_ID,jobid.proc) ) {
- error_msg.sprintf("Job id missing from GET_JOB_CONNECT_INFO request");
+ error_msg.formatstr("Job id missing from GET_JOB_CONNECT_INFO request");
goto error_wrapup;
}
@@ -12130,12 +12130,12 @@ Scheduler::get_job_connect_info_handler_implementation(int, Stream* s) {
jobad = GetJobAd(jobid.cluster,jobid.proc);
if( !jobad ) {
- error_msg.sprintf("No such job: %d.%d", jobid.cluster, jobid.proc);
+ error_msg.formatstr("No such job: %d.%d", jobid.cluster, jobid.proc);
goto error_wrapup;
}
if( !OwnerCheck2(jobad,sock->getOwner()) ) {
- error_msg.sprintf("%s is not authorized for access to the starter for job %d.%d",
+ error_msg.formatstr("%s is not authorized for access to the starter for job %d.%d",
sock->getOwner(), jobid.cluster, jobid.proc);
goto error_wrapup;
}
@@ -12164,7 +12164,7 @@ Scheduler::get_job_connect_info_handler_implementation(int, Stream* s) {
subproc = 0;
}
if( subproc == -1 || subproc >= claim_idlist.number() ) {
- error_msg.sprintf("This is a parallel job. Please specify job %d.%d.X where X is an integer from 0 to %d.",jobid.cluster,jobid.proc,claim_idlist.number()-1);
+ error_msg.formatstr("This is a parallel job. Please specify job %d.%d.X where X is an integer from 0 to %d.",jobid.cluster,jobid.proc,claim_idlist.number()-1);
goto error_wrapup;
}
else {
@@ -12229,7 +12229,7 @@ Scheduler::get_job_connect_info_handler_implementation(int, Stream* s) {
if( job_is_suitable &&
!param_boolean("SCHEDD_ENABLE_SSH_TO_JOB",true,true,jobad,NULL) )
{
- error_msg.sprintf("Job %d.%d is denied by SCHEDD_ENABLE_SSH_TO_JOB.",
+ error_msg.formatstr("Job %d.%d is denied by SCHEDD_ENABLE_SSH_TO_JOB.",
jobid.cluster,jobid.proc);
goto error_wrapup;
}
@@ -12239,11 +12239,11 @@ Scheduler::get_job_connect_info_handler_implementation(int, Stream* s) {
{
if( !retry_is_sensible ) {
// this must be a job universe that we don't support
- error_msg.sprintf("Job %d.%d does not support remote access.",
+ error_msg.formatstr("Job %d.%d does not support remote access.",
jobid.cluster,jobid.proc);
}
else {
- error_msg.sprintf("Job %d.%d is not running.",
+ error_msg.formatstr("Job %d.%d is not running.",
jobid.cluster,jobid.proc);
}
goto error_wrapup;
@@ -12359,7 +12359,7 @@ fixAttrUser( ClassAd *job )
// if it's not there, nice_user will remain 0
job->LookupInteger( ATTR_NICE_USER, nice_user );
- user.sprintf( "%s%s@%s",
+ user.formatstr( "%s%s@%s",
(nice_user) ? "nice-user." : "", owner.Value(),
scheduler.uidDomain() );
job->Assign( ATTR_USER, user );
diff --git a/src/condor_schedd.V6/schedd_files.cpp b/src/condor_schedd.V6/schedd_files.cpp
index a59f303..2d0217f 100644
--- a/src/condor_schedd.V6/schedd_files.cpp
+++ b/src/condor_schedd.V6/schedd_files.cpp
@@ -45,19 +45,19 @@ QuillErrCode schedd_files_ins_file(
ClassAd *tmpClP1 = &tmpCl1;
MyString tmp;
- tmp.sprintf("f_name = \"%s\"", fileName);
+ tmp.formatstr("f_name = \"%s\"", fileName);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("f_host = \"%s\"", fs_domain);
+ tmp.formatstr("f_host = \"%s\"", fs_domain);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("f_path = \"%s\"", path);
+ tmp.formatstr("f_path = \"%s\"", path);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("f_ts = %d", (int)f_ts);
+ tmp.formatstr("f_ts = %d", (int)f_ts);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("f_size = %d", fsize);
+ tmp.formatstr("f_size = %d", fsize);
tmpClP1->Insert(tmp.Value());
return FILEObj->file_newEvent("Files", tmpClP1);
@@ -75,22 +75,22 @@ void schedd_files_ins_usage(
ClassAd *tmpClP1 = &tmpCl1;
MyString tmp;
- tmp.sprintf("f_name = \"%s\"", fileName);
+ tmp.formatstr("f_name = \"%s\"", fileName);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("f_host = \"%s\"", fs_domain);
+ tmp.formatstr("f_host = \"%s\"", fs_domain);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("f_path = \"%s\"", path);
+ tmp.formatstr("f_path = \"%s\"", path);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("f_ts = %d", (int) f_ts);
+ tmp.formatstr("f_ts = %d", (int) f_ts);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("globalJobId = \"%s\"", globalJobId);
+ tmp.formatstr("globalJobId = \"%s\"", globalJobId);
tmpClP1->Insert(tmp.Value());
- tmp.sprintf("type = \"%s\"", type);
+ tmp.formatstr("type = \"%s\"", type);
tmpClP1->Insert(tmp.Value());
FILEObj->file_newEvent("Fileusages", tmpClP1);
@@ -139,7 +139,7 @@ void schedd_files_ins(
free(dir_tmp);
}
else {
- pathname.sprintf("%s/%s", path.Value(), tmpFile.Value());
+ pathname.formatstr("%s/%s", path.Value(), tmpFile.Value());
fileName = tmpFile;
}
diff --git a/src/condor_schedd.V6/schedd_main.cpp b/src/condor_schedd.V6/schedd_main.cpp
index c79e3c7..97a5cac 100644
--- a/src/condor_schedd.V6/schedd_main.cpp
+++ b/src/condor_schedd.V6/schedd_main.cpp
@@ -131,7 +131,7 @@ main_init(int argc, char* argv[])
if (job_queue_param_name == NULL) {
// the default place for the job_queue.log is in spool
- job_queue_name.sprintf( "%s/job_queue.log", Spool);
+ job_queue_name.formatstr( "%s/job_queue.log", Spool);
} else {
job_queue_name = job_queue_param_name; // convert char * to MyString
free(job_queue_param_name);
@@ -143,7 +143,7 @@ main_init(int argc, char* argv[])
UtcTime now(true);
hostname = get_local_hostname();
MyString job_queue_backup;
- job_queue_backup.sprintf( "%s/job_queue.bak.%s.%ld",
+ job_queue_backup.formatstr( "%s/job_queue.bak.%s.%ld",
Spool, hostname.Value(), now.seconds() );
if ( copy_file( job_queue_name.Value(), job_queue_backup.Value() ) ) {
dprintf( D_ALWAYS, "Failed to backup spool to '%s'\n",
diff --git a/src/condor_schedd.V6/schedd_stats.cpp b/src/condor_schedd.V6/schedd_stats.cpp
index 3ebcf80..e1e7dd7 100644
--- a/src/condor_schedd.V6/schedd_stats.cpp
+++ b/src/condor_schedd.V6/schedd_stats.cpp
@@ -621,7 +621,7 @@ ScheddOtherStats * ScheddOtherStatsMgr::Matches(ClassAd & ad, time_t updateTime)
ASSERT(po2);
po->sets[str] = po2;
- po2->prefix.sprintf("%s_%s_", po->prefix.Value(), str.c_str());
+ po2->prefix.formatstr("%s_%s_", po->prefix.Value(), str.c_str());
cleanStringForUseAsAttr(po2->prefix, '_', false);
po2->stats.Init(true);
diff --git a/src/condor_schedd.V6/schedd_td.cpp b/src/condor_schedd.V6/schedd_td.cpp
index 3e30f27..cf0fbe5 100644
--- a/src/condor_schedd.V6/schedd_td.cpp
+++ b/src/condor_schedd.V6/schedd_td.cpp
@@ -874,7 +874,7 @@ Scheduler::treq_upload_update_callback(TransferRequest *treq,
if ((AttrsToModify[index] == ATTR_TRANSFER_INPUT_FILES) && IsUrl(old_path_buf)) {
base = old_path_buf;
} else if ( strcmp(base,old_path_buf)!=0 ) {
- new_path_buf.sprintf(
+ new_path_buf.formatstr(
"%s%c%s",SpoolSpace,DIR_DELIM_CHAR,base);
base = new_path_buf.Value();
changed = true;
diff --git a/src/condor_schedd.V6/transfer_queue.cpp b/src/condor_schedd.V6/transfer_queue.cpp
index bd176c2..9fe7837 100644
--- a/src/condor_schedd.V6/transfer_queue.cpp
+++ b/src/condor_schedd.V6/transfer_queue.cpp
@@ -49,7 +49,7 @@ TransferQueueRequest::~TransferQueueRequest() {
char const *
TransferQueueRequest::Description() {
- m_description.sprintf("%s %s job %s (initial file %s)",
+ m_description.formatstr("%s %s job %s (initial file %s)",
m_sock ? m_sock->peer_description() : "",
m_downloading ? "downloading" : "uploading",
m_jobid.Value(),
diff --git a/src/condor_shadow.V6.1/NTreceivers.cpp b/src/condor_shadow.V6.1/NTreceivers.cpp
index 508b1fc..73f1c4b 100644
--- a/src/condor_shadow.V6.1/NTreceivers.cpp
+++ b/src/condor_shadow.V6.1/NTreceivers.cpp
@@ -1349,7 +1349,7 @@ case CONDOR_getlongdir:
while((next = directory.Next())) {
dprintf(D_ALWAYS, "next: %s\n", next);
msg.sprintf_cat("%s\n", next);
- check.sprintf("%s%c%s", path, DIR_DELIM_CHAR, next);
+ check.formatstr("%s%c%s", path, DIR_DELIM_CHAR, next);
rval = stat(check.Value(), &stat_buf);
terrno = (condor_errno_t)errno;
if(rval == -1) {
diff --git a/src/condor_shadow.V6.1/baseshadow.cpp b/src/condor_shadow.V6.1/baseshadow.cpp
index 48034a6..ffc7eb5 100644
--- a/src/condor_shadow.V6.1/baseshadow.cpp
+++ b/src/condor_shadow.V6.1/baseshadow.cpp
@@ -329,7 +329,7 @@ int BaseShadow::cdToIwd() {
"He who travels without bounds\n"
"Can't locate data.\n\n" );
MyString hold_reason;
- hold_reason.sprintf("Cannot access initial working directory %s: %s",
+ hold_reason.formatstr("Cannot access initial working directory %s: %s",
iwd.Value(), strerror(chdir_errno));
dprintf( D_ALWAYS, "%s\n",hold_reason.Value());
holdJobAndExit(hold_reason.Value(),CONDOR_HOLD_CODE_IwdError,chdir_errno);
@@ -574,7 +574,7 @@ BaseShadow::terminateJob( update_style_t kind ) // has a default argument of US_
/* The first thing we do is record that we are in a termination pending
state. */
if (kind == US_NORMAL) {
- str.sprintf("%s = TRUE", ATTR_TERMINATION_PENDING);
+ str.formatstr("%s = TRUE", ATTR_TERMINATION_PENDING);
jobAd->Insert(str.Value());
}
@@ -607,7 +607,7 @@ BaseShadow::terminateJob( update_style_t kind ) // has a default argument of US_
if (exited_by_signal == TRUE) {
reason = JOB_COREDUMPED;
- str.sprintf("%s = \"%s\"", ATTR_JOB_CORE_FILENAME, core_file_name);
+ str.formatstr("%s = \"%s\"", ATTR_JOB_CORE_FILENAME, core_file_name);
jobAd->Insert(str.Value());
} else {
reason = JOB_EXITED;
@@ -638,7 +638,7 @@ BaseShadow::terminateJob( update_style_t kind ) // has a default argument of US_
/* also store the corefilename into the jobad so we can recover this
during a termination pending scenario. */
if( reason == JOB_COREDUMPED ) {
- str.sprintf("%s = \"%s\"", ATTR_JOB_CORE_FILENAME, getCoreName());
+ str.formatstr("%s = \"%s\"", ATTR_JOB_CORE_FILENAME, getCoreName());
jobAd->Insert(str.Value());
}
@@ -728,7 +728,7 @@ BaseShadow::evictJob( int reason )
MyString from_where;
MyString machine;
if( getMachineName(machine) ) {
- from_where.sprintf(" from %s",machine.Value());
+ from_where.formatstr(" from %s",machine.Value());
}
dprintf( D_ALWAYS, "Job %d.%d is being evicted%s\n",
getCluster(), getProc(), from_where.Value() );
@@ -869,7 +869,7 @@ void BaseShadow::initUserLog()
// of the failure.
if ( !result ) {
MyString hold_reason;
- hold_reason.sprintf(
+ hold_reason.formatstr(
"Failed to initialize user log to %s", logfile.c_str());
dprintf( D_ALWAYS, "%s\n",hold_reason.Value());
holdJobAndExit(hold_reason.Value(),CONDOR_HOLD_CODE_UnableToInitUserLog,0);
@@ -908,7 +908,7 @@ void BaseShadow::initUserLog()
// of the failure.
if ( !result ) {
MyString hold_reason;
- hold_reason.sprintf(
+ hold_reason.formatstr(
"Failed to initialize user log to %s", logfile.c_str());
dprintf( D_ALWAYS, "%s\n",hold_reason.Value());
holdJobAndExit(hold_reason.Value(),CONDOR_HOLD_CODE_UnableToInitUserLog,0);
@@ -973,19 +973,19 @@ static void set_usageAd (ClassAd* jobAd, ClassAd ** ppusageAd)
while ((resname = reslist.next()) != NULL) {
MyString attr;
int64_value = -1;
- attr.sprintf("%s", resname); // provisioned value
+ attr.formatstr("%s", resname); // provisioned value
if (jobAd->LookupInteger(attr.Value(), int64_value)) {
puAd->Assign(resname, int64_value);
}
// /*for debugging*/ else { puAd->Assign(resname, 42); }
int64_value = -2;
- attr.sprintf("Request%s", resname); // requested value
+ attr.formatstr("Request%s", resname); // requested value
if (jobAd->LookupInteger(attr.Value(), int64_value)) {
puAd->Assign(attr.Value(), int64_value);
}
// /*for debugging*/ else { puAd->Assign(attr.Value(), 99); }
int64_value = -3;
- attr.sprintf("%sUsage", resname); // usage value
+ attr.formatstr("%sUsage", resname); // usage value
if (jobAd->LookupInteger(attr.Value(), int64_value)) {
puAd->Assign(attr.Value(), int64_value);
}
@@ -1340,10 +1340,10 @@ BaseShadow::updateJobInQueue( update_t type )
// won't actually connect to the job queue for it. we do this
// here since we want it for all kinds of updates...
MyString buf;
- buf.sprintf( "%s = %f", ATTR_BYTES_SENT, (prev_run_bytes_sent +
+ buf.formatstr( "%s = %f", ATTR_BYTES_SENT, (prev_run_bytes_sent +
bytesReceived()) );
jobAd->Insert( buf.Value() );
- buf.sprintf( "%s = %f", ATTR_BYTES_RECVD, (prev_run_bytes_recvd +
+ buf.formatstr( "%s = %f", ATTR_BYTES_RECVD, (prev_run_bytes_recvd +
bytesSent()) );
jobAd->Insert( buf.Value() );
diff --git a/src/condor_shadow.V6.1/mpiresource.cpp b/src/condor_shadow.V6.1/mpiresource.cpp
index 4f0ad0e..e1b89dc 100644
--- a/src/condor_shadow.V6.1/mpiresource.cpp
+++ b/src/condor_shadow.V6.1/mpiresource.cpp
@@ -34,7 +34,7 @@ void
MpiResource::printExit( FILE *fp )
{
MyString line;
- line.sprintf( "%25s ", machineName ? machineName : "Unknown machine" );
+ line.formatstr( "%25s ", machineName ? machineName : "Unknown machine" );
printExitString( jobAd, exit_reason, line );
fprintf( fp, "%s\n", line.Value() );
}
diff --git a/src/condor_shadow.V6.1/mpishadow.cpp b/src/condor_shadow.V6.1/mpishadow.cpp
index c244222..b9b9e64 100644
--- a/src/condor_shadow.V6.1/mpishadow.cpp
+++ b/src/condor_shadow.V6.1/mpishadow.cpp
@@ -481,7 +481,7 @@ MPIShadow::hackMasterAd( ClassAd *ad )
args.InsertArg("-p4pg",0);
MyString procgroup;
- procgroup.sprintf("procgroup.%d.%d",getCluster(),getProc());
+ procgroup.formatstr("procgroup.%d.%d",getCluster(),getProc());
args.InsertArg(procgroup.Value(),1);
if(!args.InsertArgsIntoClassAd(ad,NULL,&args_error)) {
@@ -512,11 +512,11 @@ MPIShadow::hackMasterAd( ClassAd *ad )
MyString new_transfer_files;
if( !ad->LookupString(ATTR_TRANSFER_INPUT_FILES, &transfer_files) ) {
// Nothing here, so we can safely add it ourselves.
- new_transfer_files.sprintf( "%s = \"procgroup.%d.%d\"",
+ new_transfer_files.formatstr( "%s = \"procgroup.%d.%d\"",
ATTR_TRANSFER_INPUT_FILES, getCluster(), getProc() );
} else {
// There's a list already. We've got to append to it.
- new_transfer_files.sprintf( "%s = \"%s, procgroup.%d.%d\"",
+ new_transfer_files.formatstr( "%s = \"%s, procgroup.%d.%d\"",
ATTR_TRANSFER_INPUT_FILES, transfer_files, getCluster(),
getProc() );
diff --git a/src/condor_shadow.V6.1/pseudo_ops.cpp b/src/condor_shadow.V6.1/pseudo_ops.cpp
index aa61584..af5b343 100644
--- a/src/condor_shadow.V6.1/pseudo_ops.cpp
+++ b/src/condor_shadow.V6.1/pseudo_ops.cpp
@@ -289,7 +289,7 @@ static void complete_path( const char *short_path, MyString &full_path )
full_path = short_path;
} else {
// strcpy(full_path,CurrentWorkingDir);
- full_path.sprintf("%s%s%s",
+ full_path.formatstr("%s%s%s",
Shadow->getIwd(),
DIR_DELIM_STRING,
short_path);
@@ -680,7 +680,7 @@ pseudo_ulog( ClassAd *ad )
}
if(err->isCriticalError()) {
- CriticalErrorBuf.sprintf(
+ CriticalErrorBuf.formatstr(
"Error from %s: %s",
err->getExecuteHost(),
err->getErrorText());
@@ -795,7 +795,7 @@ pseudo_constrain( const char *expr )
dprintf(D_SYSCALLS,"\tRequirements already refers to AgentRequirements\n");
return 0;
} else {
- newreqs.sprintf("(%s) && AgentRequirements",reqs.Value());
+ newreqs.formatstr("(%s) && AgentRequirements",reqs.Value());
dprintf(D_SYSCALLS,"\tchanging Requirements to %s\n",newreqs.Value());
return pseudo_set_job_attr("Requirements",newreqs.Value());
}
diff --git a/src/condor_shadow.V6.1/remoteresource.cpp b/src/condor_shadow.V6.1/remoteresource.cpp
index 92febcc..ae7be94 100644
--- a/src/condor_shadow.V6.1/remoteresource.cpp
+++ b/src/condor_shadow.V6.1/remoteresource.cpp
@@ -718,7 +718,7 @@ RemoteResource::initStartdInfo( const char *name, const char *pool,
MyString filetrans_claimid;
// prepend something to the claim id so that the session id
// is different for file transfer than for the claim session
- filetrans_claimid.sprintf("filetrans.%s",claim_id);
+ filetrans_claimid.formatstr("filetrans.%s",claim_id);
m_filetrans_session = ClaimIdParser(filetrans_claimid.Value());
// Get rid of session parameters set by startd.
@@ -1920,7 +1920,7 @@ RemoteResource::requestReconnect( void )
char* value = NULL;
jobAd->LookupString(ATTR_TRANSFER_KEY,&value);
if (value) {
- msg.sprintf("%s=\"%s\"",ATTR_TRANSFER_KEY,value);
+ msg.formatstr("%s=\"%s\"",ATTR_TRANSFER_KEY,value);
req.Insert(msg.Value());
free(value);
value = NULL;
@@ -1930,7 +1930,7 @@ RemoteResource::requestReconnect( void )
}
jobAd->LookupString(ATTR_TRANSFER_SOCKET,&value);
if (value) {
- msg.sprintf("%s=\"%s\"",ATTR_TRANSFER_SOCKET,value);
+ msg.formatstr("%s=\"%s\"",ATTR_TRANSFER_SOCKET,value);
req.Insert(msg.Value());
free(value);
value = NULL;
diff --git a/src/condor_startd.V6/AvailStats.cpp b/src/condor_startd.V6/AvailStats.cpp
index 04b167a..8642be4 100644
--- a/src/condor_startd.V6/AvailStats.cpp
+++ b/src/condor_startd.V6/AvailStats.cpp
@@ -218,7 +218,7 @@ AvailStats::serialize()
{
MyString state;
- state.sprintf( "%ld %d %d", (long)(time(0)-as_birthdate),
+ state.formatstr( "%ld %d %d", (long)(time(0)-as_birthdate),
as_tot_avail_time, as_last_avail_interval );
as_avail_periods.Rewind();
int item;
diff --git a/src/condor_startd.V6/Reqexp.cpp b/src/condor_startd.V6/Reqexp.cpp
index bcbe81b..95ce326 100644
--- a/src/condor_startd.V6/Reqexp.cpp
+++ b/src/condor_startd.V6/Reqexp.cpp
@@ -33,7 +33,7 @@ Reqexp::Reqexp( Resource* res_ip )
this->rip = res_ip;
MyString tmp;
- tmp.sprintf("%s = (%s) && (%s)",
+ tmp.formatstr("%s = (%s) && (%s)",
ATTR_REQUIREMENTS, "START", ATTR_IS_VALID_CHECKPOINT_PLATFORM );
if( Resource::STANDARD_SLOT != rip->get_feature() ) {
@@ -61,7 +61,7 @@ Reqexp::compute( amask_t how_much )
free( origstart );
}
- str.sprintf( "%s = %s", ATTR_START, start );
+ str.formatstr( "%s = %s", ATTR_START, start );
origstart = strdup( str.Value() );
@@ -79,7 +79,7 @@ Reqexp::compute( amask_t how_much )
if (vcp != NULL) {
/* Use whatever the config file says */
- str.sprintf("%s = %s", ATTR_IS_VALID_CHECKPOINT_PLATFORM, vcp);
+ str.formatstr("%s = %s", ATTR_IS_VALID_CHECKPOINT_PLATFORM, vcp);
m_origvalidckptpltfrm = strdup( str.Value() );
@@ -116,7 +116,7 @@ Reqexp::compute( amask_t how_much )
")"
")";
- str.sprintf( "%s = %s", ATTR_IS_VALID_CHECKPOINT_PLATFORM,
+ str.formatstr( "%s = %s", ATTR_IS_VALID_CHECKPOINT_PLATFORM,
default_vcp_expr);
m_origvalidckptpltfrm = strdup( str.Value() );
@@ -223,9 +223,9 @@ Reqexp::publish( ClassAd* ca, amask_t /*how_much*/ /*UNUSED*/ )
switch( rstate ) {
case ORIG_REQ:
ca->Insert( origstart );
- tmp.sprintf( "%s", origreqexp );
+ tmp.formatstr( "%s", origreqexp );
ca->Insert( tmp.Value() );
- tmp.sprintf( "%s", m_origvalidckptpltfrm );
+ tmp.formatstr( "%s", m_origvalidckptpltfrm );
ca->Insert( tmp.Value() );
if( Resource::STANDARD_SLOT != rip->get_feature() ) {
ca->AssignExpr( ATTR_WITHIN_RESOURCE_LIMITS,
@@ -233,13 +233,13 @@ Reqexp::publish( ClassAd* ca, amask_t /*how_much*/ /*UNUSED*/ )
}
break;
case UNAVAIL_REQ:
- tmp.sprintf( "%s = False", ATTR_REQUIREMENTS );
+ tmp.formatstr( "%s = False", ATTR_REQUIREMENTS );
ca->Insert( tmp.Value() );
break;
case COD_REQ:
- tmp.sprintf( "%s = True", ATTR_RUNNING_COD_JOB );
+ tmp.formatstr( "%s = True", ATTR_RUNNING_COD_JOB );
ca->Insert( tmp.Value() );
- tmp.sprintf( "%s = False && %s", ATTR_REQUIREMENTS,
+ tmp.formatstr( "%s = False && %s", ATTR_REQUIREMENTS,
ATTR_RUNNING_COD_JOB );
ca->Insert( tmp.Value() );
break;
diff --git a/src/condor_startd.V6/ResMgr.cpp b/src/condor_startd.V6/ResMgr.cpp
index 54f4c2d..26615bb 100644
--- a/src/condor_startd.V6/ResMgr.cpp
+++ b/src/condor_startd.V6/ResMgr.cpp
@@ -235,7 +235,7 @@ ResMgr::init_config_classad( void )
configInsert( config_classad, "HIBERNATE", false );
if( !configInsert( config_classad, ATTR_UNHIBERNATE, false ) ) {
MyString default_expr;
- default_expr.sprintf("MY.%s =!= UNDEFINED",ATTR_MACHINE_LAST_MATCH_TIME);
+ default_expr.formatstr("MY.%s =!= UNDEFINED",ATTR_MACHINE_LAST_MATCH_TIME);
config_classad->AssignExpr( ATTR_UNHIBERNATE, default_expr.Value() );
}
#endif /* HAVE_HIBERNATION */
@@ -761,11 +761,11 @@ ResMgr::initTypes( bool except )
if( type_strings[i] ) {
continue;
}
- buf.sprintf("SLOT_TYPE_%d", i);
+ buf.formatstr("SLOT_TYPE_%d", i);
tmp = param(buf.Value());
if (!tmp) {
if (param_boolean("ALLOW_VM_CRUFT", false)) {
- buf.sprintf("VIRTUAL_MACHINE_TYPE_%d", i);
+ buf.formatstr("VIRTUAL_MACHINE_TYPE_%d", i);
if (!(tmp = param(buf.Value()))) {
continue;
}
@@ -798,9 +798,9 @@ ResMgr::countTypes( int** array_ptr, bool except )
_checkInvalidParam("NUM_VIRTUAL_MACHINES_TYPE_0", except);
for( i=1; i<max_types; i++ ) {
- param_name.sprintf("NUM_SLOTS_TYPE_%d", i);
+ param_name.formatstr("NUM_SLOTS_TYPE_%d", i);
if (param_boolean("ALLOW_VM_CRUFT", false)) {
- cruft_name.sprintf("NUM_VIRTUAL_MACHINES_TYPE_%d", i);
+ cruft_name.formatstr("NUM_VIRTUAL_MACHINES_TYPE_%d", i);
my_type_nums[i] = param_integer(param_name.Value(),
param_integer(cruft_name.Value(),
0));
@@ -1017,7 +1017,7 @@ ResMgr::GetConfigExecuteDir( int slot_id, MyString *execute_dir, MyString *parti
{
MyString execute_param;
char *execute_value = NULL;
- execute_param.sprintf("SLOT%d_EXECUTE",slot_id);
+ execute_param.formatstr("SLOT%d_EXECUTE",slot_id);
execute_value = param( execute_param.Value() );
if( !execute_value ) {
execute_value = param( "EXECUTE" );
diff --git a/src/condor_startd.V6/Resource.cpp b/src/condor_startd.V6/Resource.cpp
index 18cca2e..7124f0e 100644
--- a/src/condor_startd.V6/Resource.cpp
+++ b/src/condor_startd.V6/Resource.cpp
@@ -69,7 +69,7 @@ Resource::Resource( CpuAttributes* cap, int rid, bool multiple_slots, Resource*
m_id_dispenser = NULL;
// we need this before we instantiate the Reqexp object...
- tmp.sprintf( "SLOT_TYPE_%d_PARTITIONABLE", type() );
+ tmp.formatstr( "SLOT_TYPE_%d_PARTITIONABLE", type() );
if( param_boolean( tmp.Value(), false ) ) {
set_feature( PARTITIONABLE_SLOT );
@@ -97,7 +97,7 @@ Resource::Resource( CpuAttributes* cap, int rid, bool multiple_slots, Resource*
tmpName = my_full_hostname();
}
if( multiple_slots || get_feature() == PARTITIONABLE_SLOT ) {
- tmp.sprintf( "%s@%s", r_id_str, tmpName );
+ tmp.formatstr( "%s@%s", r_id_str, tmpName );
r_name = strdup( tmp.Value() );
} else {
r_name = strdup( tmpName );
@@ -113,7 +113,7 @@ Resource::Resource( CpuAttributes* cap, int rid, bool multiple_slots, Resource*
if (log) {
MyString avail_stats_ckpt_file(log);
free(log);
- tmp.sprintf( "%c.avail_stats.%d", DIR_DELIM_CHAR, rid);
+ tmp.formatstr( "%c.avail_stats.%d", DIR_DELIM_CHAR, rid);
avail_stats_ckpt_file += tmp;
r_avail_stats.checkpoint_filename(avail_stats_ckpt_file);
}
@@ -661,10 +661,10 @@ Resource::hackLoadForCOD( void )
}
MyString load;
- load.sprintf( "%s=%.2f", ATTR_LOAD_AVG, r_pre_cod_total_load );
+ load.formatstr( "%s=%.2f", ATTR_LOAD_AVG, r_pre_cod_total_load );
MyString c_load;
- c_load.sprintf( "%s=%.2f", ATTR_CONDOR_LOAD_AVG, r_pre_cod_condor_load );
+ c_load.formatstr( "%s=%.2f", ATTR_CONDOR_LOAD_AVG, r_pre_cod_condor_load );
if( IsDebugVerbose( D_LOAD ) ) {
if( r_cod_mgr->isRunning() ) {
@@ -1074,7 +1074,7 @@ Resource::final_update( void )
* the IP was added to allow the collector to create a hash key to delete in O(1).
*/
ClassAd::EscapeStringValue( r_name, escaped_name );
- line.sprintf( "( TARGET.%s == \"%s\" )", ATTR_NAME, escaped_name.Value() );
+ line.formatstr( "( TARGET.%s == \"%s\" )", ATTR_NAME, escaped_name.Value() );
invalidate_ad.AssignExpr( ATTR_REQUIREMENTS, line.Value() );
invalidate_ad.Assign( ATTR_NAME, r_name );
invalidate_ad.Assign( ATTR_MY_ADDRESS, daemonCore->publicNetworkIpAddr());
@@ -1209,7 +1209,7 @@ Resource::hold_job( bool soft )
want_hold_expr = r_classad->LookupExpr("WANT_HOLD");
if( want_hold_expr ) {
- want_hold_str.sprintf( "%s = %s", "WANT_HOLD",
+ want_hold_str.formatstr( "%s = %s", "WANT_HOLD",
ExprTreeToString( want_hold_expr ) );
}
@@ -2054,7 +2054,7 @@ Resource::publishDeathTime( ClassAd* cap )
}
}
- classad_attribute.sprintf( "%s=%d", ATTR_TIME_TO_LIVE, relative_death_time );
+ classad_attribute.formatstr( "%s=%d", ATTR_TIME_TO_LIVE, relative_death_time );
cap->Insert( classad_attribute.Value() );
return;
}
@@ -2677,7 +2677,7 @@ Resource::getHookKeyword()
{
if (!m_hook_keyword_initialized) {
MyString param_name;
- param_name.sprintf("%s_JOB_HOOK_KEYWORD", r_id_str);
+ param_name.formatstr("%s_JOB_HOOK_KEYWORD", r_id_str);
m_hook_keyword = param(param_name.Value());
if (!m_hook_keyword) {
m_hook_keyword = param("STARTD_JOB_HOOK_KEYWORD");
diff --git a/src/condor_startd.V6/StartdHookMgr.cpp b/src/condor_startd.V6/StartdHookMgr.cpp
index 572e18f..b12894b 100644
--- a/src/condor_startd.V6/StartdHookMgr.cpp
+++ b/src/condor_startd.V6/StartdHookMgr.cpp
@@ -109,7 +109,7 @@ StartdHookMgr::getHookPath(HookType hook_type, Resource* rip)
char* path = hook_paths[(int)hook_type];
if (!path) {
MyString _param;
- _param.sprintf("%s_HOOK_%s", keyword, getHookTypeString(hook_type));
+ _param.formatstr("%s_HOOK_%s", keyword, getHookTypeString(hook_type));
bool hperr = !validateHookPath(_param.Value(), path);
// Here the distinction between undefined hook and a hook path error
// is being collapsed
@@ -210,7 +210,7 @@ StartdHookMgr::handleHookFetchWork(FetchClient* fetch_client)
char* keyword = rip->getHookKeyword();
ASSERT(keyword && keyword != UNDEFINED);
MyString keyword_attr;
- keyword_attr.sprintf("%s = \"%s\"", ATTR_HOOK_KEYWORD, keyword);
+ keyword_attr.formatstr("%s = \"%s\"", ATTR_HOOK_KEYWORD, keyword);
job_ad->Insert(keyword_attr.Value());
}
diff --git a/src/condor_startd.V6/Starter.cpp b/src/condor_startd.V6/Starter.cpp
index 5e2cfbb..3a1c332 100644
--- a/src/condor_startd.V6/Starter.cpp
+++ b/src/condor_startd.V6/Starter.cpp
@@ -635,7 +635,7 @@ Starter::exited(int status)
jobAd->Assign(ATTR_IMAGE_SIZE, 0);
jobAd->Assign(ATTR_JOB_CMD, "boinc");
MyString gjid;
- gjid.sprintf("%s#%d#%d#%d", get_local_hostname().Value(),
+ gjid.formatstr("%s#%d#%d#%d", get_local_hostname().Value(),
now, 1, now);
jobAd->Assign(ATTR_GLOBAL_JOB_ID, gjid);
}
diff --git a/src/condor_startd.V6/claim.cpp b/src/condor_startd.V6/claim.cpp
index a2cc641..1d69b58 100644
--- a/src/condor_startd.V6/claim.cpp
+++ b/src/condor_startd.V6/claim.cpp
@@ -173,18 +173,18 @@ Claim::publish( ClassAd* cad, amask_t how_much )
Derek <wright@xxxxxxxxxxx> 2005-08-11
*/
- line.sprintf( "%s = %f", ATTR_CURRENT_RANK, c_rank );
+ line.formatstr( "%s = %f", ATTR_CURRENT_RANK, c_rank );
cad->Insert( line.Value() );
if( c_client ) {
remoteUser = c_client->user();
if( remoteUser ) {
- line.sprintf( "%s=\"%s\"", ATTR_REMOTE_USER, remoteUser );
+ line.formatstr( "%s=\"%s\"", ATTR_REMOTE_USER, remoteUser );
cad->Insert( line.Value() );
}
tmp = c_client->owner();
if( tmp ) {
- line.sprintf( "%s=\"%s\"", ATTR_REMOTE_OWNER, tmp );
+ line.formatstr( "%s=\"%s\"", ATTR_REMOTE_OWNER, tmp );
cad->Insert( line.Value() );
}
tmp = c_client->accountingGroup();
@@ -196,15 +196,15 @@ Claim::publish( ClassAd* cad, amask_t how_much )
uidDom = strchr(remoteUser,'@');
}
if ( uidDom ) {
- line.sprintf("%s=\"%s%s\"",ATTR_ACCOUNTING_GROUP,tmp,uidDom);
+ line.formatstr("%s=\"%s%s\"",ATTR_ACCOUNTING_GROUP,tmp,uidDom);
} else {
- line.sprintf("%s=\"%s\"", ATTR_ACCOUNTING_GROUP, tmp );
+ line.formatstr("%s=\"%s\"", ATTR_ACCOUNTING_GROUP, tmp );
}
cad->Insert( line.Value() );
}
tmp = c_client->host();
if( tmp ) {
- line.sprintf( "%s=\"%s\"", ATTR_CLIENT_MACHINE, tmp );
+ line.formatstr( "%s=\"%s\"", ATTR_CLIENT_MACHINE, tmp );
cad->Insert( line.Value() );
}
@@ -219,7 +219,7 @@ Claim::publish( ClassAd* cad, amask_t how_much )
if(c_universe == CONDOR_UNIVERSE_STANDARD) {
numJobPids = 1;
}
- line.sprintf("%s=%d", ATTR_NUM_PIDS, numJobPids);
+ line.formatstr("%s=%d", ATTR_NUM_PIDS, numJobPids);
cad->Insert( line.Value() );
if ((tmp = c_client->rmtgrp())) {
@@ -232,22 +232,22 @@ Claim::publish( ClassAd* cad, amask_t how_much )
}
if( (c_cluster > 0) && (c_proc >= 0) ) {
- line.sprintf( "%s=\"%d.%d\"", ATTR_JOB_ID, c_cluster, c_proc );
+ line.formatstr( "%s=\"%d.%d\"", ATTR_JOB_ID, c_cluster, c_proc );
cad->Insert( line.Value() );
}
if( c_global_job_id ) {
- line.sprintf( "%s=\"%s\"", ATTR_GLOBAL_JOB_ID, c_global_job_id );
+ line.formatstr( "%s=\"%s\"", ATTR_GLOBAL_JOB_ID, c_global_job_id );
cad->Insert( line.Value() );
}
if( c_job_start > 0 ) {
- line.sprintf( "%s=%d", ATTR_JOB_START, c_job_start );
+ line.formatstr( "%s=%d", ATTR_JOB_START, c_job_start );
cad->Insert( line.Value() );
}
if( c_last_pckpt > 0 ) {
- line.sprintf( "%s=%d", ATTR_LAST_PERIODIC_CHECKPOINT, c_last_pckpt );
+ line.formatstr( "%s=%d", ATTR_LAST_PERIODIC_CHECKPOINT, c_last_pckpt );
cad->Insert( line.Value() );
}
@@ -255,7 +255,7 @@ Claim::publish( ClassAd* cad, amask_t how_much )
// only for the opportunistic job, not COD)
if( isActive() ) {
unsigned long imgsize = imageSize();
- line.sprintf( "%s = %lu", ATTR_IMAGE_SIZE, imgsize );
+ line.formatstr( "%s = %lu", ATTR_IMAGE_SIZE, imgsize );
cad->Insert( line.Value() );
}
@@ -279,17 +279,17 @@ Claim::publishPreemptingClaim( ClassAd* cad, amask_t /*how_much*/ /*UNUSED*/ )
char *remoteUser;
if( c_client && c_client->user() ) {
- line.sprintf( "%s = %f", ATTR_PREEMPTING_RANK, c_rank );
+ line.formatstr( "%s = %f", ATTR_PREEMPTING_RANK, c_rank );
cad->Insert( line.Value() );
remoteUser = c_client->user();
if( remoteUser ) {
- line.sprintf( "%s=\"%s\"", ATTR_PREEMPTING_USER, remoteUser );
+ line.formatstr( "%s=\"%s\"", ATTR_PREEMPTING_USER, remoteUser );
cad->Insert( line.Value() );
}
tmp = c_client->owner();
if( tmp ) {
- line.sprintf( "%s=\"%s\"", ATTR_PREEMPTING_OWNER, tmp );
+ line.formatstr( "%s=\"%s\"", ATTR_PREEMPTING_OWNER, tmp );
cad->Insert( line.Value() );
}
tmp = c_client->accountingGroup();
@@ -301,16 +301,16 @@ Claim::publishPreemptingClaim( ClassAd* cad, amask_t /*how_much*/ /*UNUSED*/ )
uidDom = strchr(remoteUser,'@');
}
if ( uidDom ) {
- line.sprintf("%s=\"%s%s\"",ATTR_PREEMPTING_ACCOUNTING_GROUP,tmp,uidDom);
+ line.formatstr("%s=\"%s%s\"",ATTR_PREEMPTING_ACCOUNTING_GROUP,tmp,uidDom);
} else {
- line.sprintf("%s=\"%s\"", ATTR_PREEMPTING_ACCOUNTING_GROUP, tmp );
+ line.formatstr("%s=\"%s\"", ATTR_PREEMPTING_ACCOUNTING_GROUP, tmp );
}
cad->Insert( line.Value() );
}
tmp = c_client->getConcurrencyLimits();
if (tmp) {
- line.sprintf("%s=\"%s\"", ATTR_PREEMPTING_CONCURRENCY_LIMITS, tmp);
+ line.formatstr("%s=\"%s\"", ATTR_PREEMPTING_CONCURRENCY_LIMITS, tmp);
cad->Insert(line.Value());
}
}
@@ -460,19 +460,19 @@ Claim::publishStateTimes( ClassAd* cad )
// Now that we have all the right values, publish them.
if( my_job_run > 0 ) {
- line.sprintf( "%s=%ld", ATTR_TOTAL_JOB_RUN_TIME, (long)my_job_run );
+ line.formatstr( "%s=%ld", ATTR_TOTAL_JOB_RUN_TIME, (long)my_job_run );
cad->Insert( line.Value() );
}
if( my_job_sus > 0 ) {
- line.sprintf( "%s=%ld", ATTR_TOTAL_JOB_SUSPEND_TIME, (long)my_job_sus );
+ line.formatstr( "%s=%ld", ATTR_TOTAL_JOB_SUSPEND_TIME, (long)my_job_sus );
cad->Insert( line.Value() );
}
if( my_claim_run > 0 ) {
- line.sprintf( "%s=%ld", ATTR_TOTAL_CLAIM_RUN_TIME, (long)my_claim_run );
+ line.formatstr( "%s=%ld", ATTR_TOTAL_CLAIM_RUN_TIME, (long)my_claim_run );
cad->Insert( line.Value() );
}
if( my_claim_sus > 0 ) {
- line.sprintf( "%s=%ld", ATTR_TOTAL_CLAIM_SUSPEND_TIME, (long)my_claim_sus );
+ line.formatstr( "%s=%ld", ATTR_TOTAL_CLAIM_SUSPEND_TIME, (long)my_claim_sus );
cad->Insert( line.Value() );
}
}
@@ -1249,7 +1249,7 @@ Claim::setRequestStream(Stream* stream)
if( c_request_stream ) {
MyString desc;
- desc.sprintf("request claim %s", publicClaimId() );
+ desc.formatstr("request claim %s", publicClaimId() );
int register_rc = daemonCore->Register_Socket(
c_request_stream,
diff --git a/src/condor_startd.V6/cod_mgr.cpp b/src/condor_startd.V6/cod_mgr.cpp
index 86adc5c..c774e75 100644
--- a/src/condor_startd.V6/cod_mgr.cpp
+++ b/src/condor_startd.V6/cod_mgr.cpp
@@ -360,7 +360,7 @@ CODMgr::activate( Stream* s, ClassAd* req, Claim* claim )
}
MyString line;
- line.sprintf( "%s = \"%s\"", ATTR_RESULT,
+ line.formatstr( "%s = \"%s\"", ATTR_RESULT,
rval ? getCAResultString(CA_SUCCESS)
: getCAResultString(CA_FAILURE) );
diff --git a/src/condor_startd.V6/command.cpp b/src/condor_startd.V6/command.cpp
index 5b86a07..bac7e9b 100644
--- a/src/condor_startd.V6/command.cpp
+++ b/src/condor_startd.V6/command.cpp
@@ -2061,7 +2061,7 @@ caLocateStarter( Stream *s, char* cmd_str, ClassAd* req_ad )
strcasecmp( startd_sends_alives.c_str(), "false" ) )
{
MyString err_msg;
- err_msg.sprintf("Required %s, not found in request",
+ err_msg.formatstr("Required %s, not found in request",
ATTR_SCHEDD_IP_ADDR);
sendErrorReply( s, cmd_str, CA_FAILURE, err_msg.Value() );
rval = FALSE;
diff --git a/src/condor_startd.V6/startd_cron_job_params.cpp b/src/condor_startd.V6/startd_cron_job_params.cpp
index 473d891..d221530 100644
--- a/src/condor_startd.V6/startd_cron_job_params.cpp
+++ b/src/condor_startd.V6/startd_cron_job_params.cpp
@@ -65,7 +65,7 @@ StartdCronJobParams::Initialize( void )
// Print out the slots for D_FULLDEBUG
if ( IsFulldebug(D_FULLDEBUG) ) {
MyString s;
- s.sprintf( "CronJob '%s' slots: ", GetName() );
+ s.formatstr( "CronJob '%s' slots: ", GetName() );
if ( m_slots.empty() ) {
s += "ALL";
}
diff --git a/src/condor_startd.V6/util.cpp b/src/condor_startd.V6/util.cpp
index 17794ae..1c0b247 100644
--- a/src/condor_startd.V6/util.cpp
+++ b/src/condor_startd.V6/util.cpp
@@ -37,7 +37,7 @@ static bool
not_root_squashed( char const *exec_path )
{
MyString test_dir;
- test_dir.sprintf("%s/.root_squash_test", exec_path);
+ test_dir.formatstr("%s/.root_squash_test", exec_path);
if (rmdir(test_dir.Value()) == -1) {
if (errno != ENOENT) {
@@ -190,7 +190,7 @@ check_recovery_file( const char *execute_dir )
return;
}
- recovery_file.sprintf( "%s.recover", execute_dir );
+ recovery_file.formatstr( "%s.recover", execute_dir );
StatInfo si( recovery_file.Value() );
@@ -337,8 +337,8 @@ cleanup_execute_dir(int pid, char const *exec_path)
// We're trying to delete a specific subdirectory, either
// b/c a starter just exited and we might need to clean up
// after it, or because we're in a recursive call.
- pid_dir.sprintf( "dir_%d", pid );
- pid_dir_path.sprintf( "%s/%s", exec_path, pid_dir.Value() );
+ pid_dir.formatstr( "dir_%d", pid );
+ pid_dir_path.formatstr( "%s/%s", exec_path, pid_dir.Value() );
check_recovery_file( pid_dir_path.Value() );
diff --git a/src/condor_startd.V6/vmuniverse_mgr.cpp b/src/condor_startd.V6/vmuniverse_mgr.cpp
index f239e6e..e413e41 100644
--- a/src/condor_startd.V6/vmuniverse_mgr.cpp
+++ b/src/condor_startd.V6/vmuniverse_mgr.cpp
@@ -418,7 +418,7 @@ VMUniverseMgr::testVMGahp(const char* gahppath, const char* vmtype)
#if !defined(WIN32)
if( can_switch_ids() ) {
MyString tmp_str;
- tmp_str.sprintf("%d", (int)get_condor_uid());
+ tmp_str.formatstr("%d", (int)get_condor_uid());
SetEnv("VMGAHP_USER_UID", tmp_str.Value());
}
#endif
@@ -688,7 +688,7 @@ VMUniverseMgr::freeVM(pid_t s_pid)
MyString pid_dir;
Directory execute_dir(info->m_execute_dir.Value(), PRIV_ROOT);
- pid_dir.sprintf("dir_%ld", (long)s_pid);
+ pid_dir.formatstr("dir_%ld", (long)s_pid);
if( execute_dir.Find_Named_Entry( pid_dir.Value() ) ) {
// starter didn't exit cleanly,
@@ -882,7 +882,7 @@ VMUniverseMgr::killVM(const char *matchstring)
#if !defined(WIN32)
if( can_switch_ids() ) {
MyString tmp_str;
- tmp_str.sprintf("%d", (int)get_condor_uid());
+ tmp_str.formatstr("%d", (int)get_condor_uid());
SetEnv("VMGAHP_USER_UID", tmp_str.Value());
}
#endif
@@ -922,7 +922,7 @@ VMUniverseMgr::killVM(VMStarterInfo *info)
MyString matchstring;
MyString workingdir;
- workingdir.sprintf("%s%cdir_%ld", info->m_execute_dir.Value(),
+ workingdir.formatstr("%s%cdir_%ld", info->m_execute_dir.Value(),
DIR_DELIM_CHAR, (long)info->m_pid);
if( (strcasecmp(m_vm_type.Value(), CONDOR_VM_UNIVERSE_XEN ) == MATCH) || (strcasecmp(m_vm_type.Value(), CONDOR_VM_UNIVERSE_KVM) == 0)) {
diff --git a/src/condor_starter.V6.1/NTsenders.cpp b/src/condor_starter.V6.1/NTsenders.cpp
index f39ba82..42a513e 100644
--- a/src/condor_starter.V6.1/NTsenders.cpp
+++ b/src/condor_starter.V6.1/NTsenders.cpp
@@ -854,7 +854,7 @@ int REMOTE_CONDOR_ulog_error_printf( int hold_reason_code, int hold_reason_subco
int retval;
va_start(args,str);
- buf.vsprintf(str,args);
+ buf.vformatstr(str,args);
retval = REMOTE_CONDOR_ulog_error( hold_reason_code, hold_reason_subcode, buf.Value() );
va_end(args);
diff --git a/src/condor_starter.V6.1/StarterHookMgr.cpp b/src/condor_starter.V6.1/StarterHookMgr.cpp
index 52ae4a3..3be3fce 100644
--- a/src/condor_starter.V6.1/StarterHookMgr.cpp
+++ b/src/condor_starter.V6.1/StarterHookMgr.cpp
@@ -123,7 +123,7 @@ bool StarterHookMgr::getHookPath(HookType hook_type, char*& hpath)
hpath = NULL;
if (!m_hook_keyword) return true;
MyString _param;
- _param.sprintf("%s_HOOK_%s", m_hook_keyword, getHookTypeString(hook_type));
+ _param.formatstr("%s_HOOK_%s", m_hook_keyword, getHookTypeString(hook_type));
return validateHookPath(_param.Value(), hpath);
}
@@ -132,7 +132,7 @@ int StarterHookMgr::getHookTimeout(HookType hook_type, int def_value)
{
if (!m_hook_keyword) return 0;
MyString _param;
- _param.sprintf("%s_HOOK_%s_TIMEOUT", m_hook_keyword, getHookTypeString(hook_type));
+ _param.formatstr("%s_HOOK_%s_TIMEOUT", m_hook_keyword, getHookTypeString(hook_type));
return param_integer(_param.Value(), def_value);
}
@@ -156,7 +156,7 @@ StarterHookMgr::tryHookPrepareJob()
if (!spawn(hook_client, NULL, &hook_stdin, PRIV_USER_FINAL, &env)) {
MyString err_msg;
- err_msg.sprintf("failed to execute HOOK_PREPARE_JOB (%s)",
+ err_msg.formatstr("failed to execute HOOK_PREPARE_JOB (%s)",
m_hook_prepare_job);
dprintf(D_ALWAYS|D_FAILURE,
"ERROR in StarterHookMgr::tryHookPrepareJob: %s\n",
@@ -292,7 +292,7 @@ HookPrepareJobClient::hookExited(int exit_status) {
subcode = WEXITSTATUS(exit_status);
}
MyString err_msg;
- err_msg.sprintf("HOOK_PREPARE_JOB (%s) failed (%s)", m_hook_path,
+ err_msg.formatstr("HOOK_PREPARE_JOB (%s) failed (%s)", m_hook_path,
status_msg.Value());
dprintf(D_ALWAYS|D_FAILURE,
"ERROR in StarterHookMgr::tryHookPrepareJob: %s\n",
diff --git a/src/condor_starter.V6.1/baseStarter.cpp b/src/condor_starter.V6.1/baseStarter.cpp
index b60a16e..2ad9e19 100644
--- a/src/condor_starter.V6.1/baseStarter.cpp
+++ b/src/condor_starter.V6.1/baseStarter.cpp
@@ -136,7 +136,7 @@ CStarter::Init( JobInfoCommunicator* my_jic, const char* original_cwd,
// EXECUTE is, or our CWD if that's not defined...
WorkingDir = Execute;
} else {
- WorkingDir.sprintf( "%s%cdir_%ld", Execute, DIR_DELIM_CHAR,
+ WorkingDir.formatstr( "%s%cdir_%ld", Execute, DIR_DELIM_CHAR,
(long)daemonCore->getpid() );
}
@@ -668,7 +668,7 @@ int
CStarter::vSSHDFailed(Stream *s,bool retry,char const *fmt,va_list args)
{
MyString error_msg;
- error_msg.vsprintf( fmt, args );
+ error_msg.vformatstr( fmt, args );
// old classads cannot handle a string ending in a double quote
// followed by a newline, so strip off any trailing newline
@@ -744,7 +744,7 @@ static bool extract_delimited_data_as_base64(
int end = find_str_in_buffer(input_buffer,input_len,end_marker);
if( start < 0 ) {
if( error_msg ) {
- error_msg->sprintf("Failed to find '%s' in input: %.*s",
+ error_msg->formatstr("Failed to find '%s' in input: %.*s",
begin_marker,input_len,input_buffer);
}
return false;
@@ -752,7 +752,7 @@ static bool extract_delimited_data_as_base64(
start += strlen(begin_marker);
if( end < 0 || end < start ) {
if( error_msg ) {
- error_msg->sprintf("Failed to find '%s' in input: %.*s",
+ error_msg->formatstr("Failed to find '%s' in input: %.*s",
end_marker,input_len,input_buffer);
}
return false;
@@ -776,7 +776,7 @@ static bool extract_delimited_data(
int end = find_str_in_buffer(input_buffer,input_len,end_marker);
if( start < 0 ) {
if( error_msg ) {
- error_msg->sprintf("Failed to find '%s' in input: %.*s",
+ error_msg->formatstr("Failed to find '%s' in input: %.*s",
begin_marker,input_len,input_buffer);
}
return false;
@@ -784,12 +784,12 @@ static bool extract_delimited_data(
start += strlen(begin_marker);
if( end < 0 || end < start ) {
if( error_msg ) {
- error_msg->sprintf("Failed to find '%s' in input: %.*s",
+ error_msg->formatstr("Failed to find '%s' in input: %.*s",
end_marker,input_len,input_buffer);
}
return false;
}
- output_buffer.sprintf("%.*s",end-start,input_buffer+start);
+ output_buffer.formatstr("%.*s",end-start,input_buffer+start);
return true;
}
@@ -867,9 +867,9 @@ CStarter::startSSHD( int /*cmd*/, Stream* s )
}
MyString ssh_to_job_sshd_setup;
MyString ssh_to_job_shell_setup;
- ssh_to_job_sshd_setup.sprintf(
+ ssh_to_job_sshd_setup.formatstr(
"%s%ccondor_ssh_to_job_sshd_setup",libexec.Value(),DIR_DELIM_CHAR);
- ssh_to_job_shell_setup.sprintf(
+ ssh_to_job_shell_setup.formatstr(
"%s%ccondor_ssh_to_job_shell_setup",libexec.Value(),DIR_DELIM_CHAR);
if( access(ssh_to_job_sshd_setup.Value(),X_OK)!=0 ) {
@@ -1040,7 +1040,7 @@ CStarter::startSSHD( int /*cmd*/, Stream* s )
// look for magic success string
if( find_str_in_buffer(setup_output,setup_output_len,"condor_ssh_to_job_sshd_setup SUCCESS") < 0 ) {
- error_msg.sprintf("condor_ssh_to_job_sshd_setup failed: %s",
+ error_msg.formatstr("condor_ssh_to_job_sshd_setup failed: %s",
setup_output);
free( setup_output );
return SSHDFailed(s,"%s",error_msg.Value());
@@ -1107,7 +1107,7 @@ CStarter::startSSHD( int /*cmd*/, Stream* s )
dprintf(D_FULLDEBUG,"StartSSHD: session_dir='%s'\n",session_dir.Value());
MyString sshd_config_file;
- sshd_config_file.sprintf("%s%csshd_config",session_dir.Value(),DIR_DELIM_CHAR);
+ sshd_config_file.formatstr("%s%csshd_config",session_dir.Value(),DIR_DELIM_CHAR);
@@ -1196,7 +1196,7 @@ CStarter::startSSHD( int /*cmd*/, Stream* s )
MyString sshd_log_fname;
- sshd_log_fname.sprintf(
+ sshd_log_fname.formatstr(
"%s%c%s",session_dir.Value(),DIR_DELIM_CHAR,"sshd.log");
@@ -1614,12 +1614,12 @@ CStarter::jobWaitUntilExecuteTime( void )
// got a positive integer. Otherwise we'll have to kick out
//
if ( ! jobAd->EvalInteger( ATTR_DEFERRAL_TIME, NULL, deferralTime ) ) {
- error.sprintf( "Invalid deferred execution time for Job %d.%d.",
+ error.formatstr( "Invalid deferred execution time for Job %d.%d.",
this->jic->jobCluster(),
this->jic->jobProc() );
abort = true;
} else if ( deferralTime <= 0 ) {
- error.sprintf( "Invalid execution time '%d' for Job %d.%d.",
+ error.formatstr( "Invalid execution time '%d' for Job %d.%d.",
deferralTime,
this->jic->jobCluster(),
this->jic->jobProc() );
@@ -1673,7 +1673,7 @@ CStarter::jobWaitUntilExecuteTime( void )
//
if ( deltaT < 0 ) {
if ( abs( deltaT ) > deferralWindow ) {
- error.sprintf( "Job %d.%d missed its execution time.",
+ error.formatstr( "Job %d.%d missed its execution time.",
this->jic->jobCluster(),
this->jic->jobProc() );
abort = true;
@@ -2026,11 +2026,11 @@ CStarter::WriteRecoveryFile( ClassAd *recovery_ad )
}
if ( m_recoveryFile.Length() == 0 ) {
- m_recoveryFile.sprintf( "%s%cdir_%ld.recover", Execute,
+ m_recoveryFile.formatstr( "%s%cdir_%ld.recover", Execute,
DIR_DELIM_CHAR, (long)daemonCore->getpid() );
}
- tmp_file.sprintf( "%s.tmp", m_recoveryFile.Value() );
+ tmp_file.formatstr( "%s.tmp", m_recoveryFile.Value() );
tmp_fp = safe_fcreate_replace_if_exists( tmp_file.Value(), "w" );
if ( tmp_fp == NULL ) {
@@ -2515,7 +2515,7 @@ CStarter::publishJobInfoAd(List<UserProc>* proc_list, ClassAd* ad)
if (m_deferred_job_update)
{
MyString buf;
- buf.sprintf( "%s=\"Exited\"", ATTR_JOB_STATE );
+ buf.formatstr( "%s=\"Exited\"", ATTR_JOB_STATE );
}
UserProc *job;
@@ -2702,7 +2702,7 @@ CStarter::getMySlotNumber( void )
char* resource_prefix = param("STARTD_RESOURCE_PREFIX");
if( resource_prefix ) {
- prefix.sprintf(".%s",resource_prefix);
+ prefix.formatstr(".%s",resource_prefix);
free( resource_prefix );
}
else {
@@ -2740,7 +2740,7 @@ CStarter::getMySlotName(void) {
char* resource_prefix = param("STARTD_RESOURCE_PREFIX");
if( resource_prefix ) {
- prefix.sprintf(".%s",resource_prefix);
+ prefix.formatstr(".%s",resource_prefix);
free( resource_prefix );
}
else {
@@ -2846,7 +2846,7 @@ CStarter::removeTempExecuteDir( void )
#if !defined(WIN32)
if (condorPrivSepHelper() != NULL) {
MyString path_name;
- path_name.sprintf("%s/%s", Execute, dir_name.Value());
+ path_name.formatstr("%s/%s", Execute, dir_name.Value());
if (!privsep_remove_dir(path_name.Value())) {
dprintf(D_ALWAYS,
"privsep_remove_dir failed for %s\n",
@@ -2928,7 +2928,7 @@ CStarter::WriteAdFiles()
ad = this->jic->jobClassAd();
if (ad != NULL)
{
- filename.sprintf("%s%c%s", dir, DIR_DELIM_CHAR, JOB_AD_FILENAME);
+ filename.formatstr("%s%c%s", dir, DIR_DELIM_CHAR, JOB_AD_FILENAME);
fp = safe_fopen_wrapper_follow(filename.Value(), "w");
if (!fp)
{
@@ -2955,7 +2955,7 @@ CStarter::WriteAdFiles()
ad = this->jic->machClassAd();
if (ad != NULL)
{
- filename.sprintf("%s%c%s", dir, DIR_DELIM_CHAR, MACHINE_AD_FILENAME);
+ filename.formatstr("%s%c%s", dir, DIR_DELIM_CHAR, MACHINE_AD_FILENAME);
fp = safe_fopen_wrapper_follow(filename.Value(), "w");
if (!fp)
{
diff --git a/src/condor_starter.V6.1/glexec_privsep_helper.linux.cpp b/src/condor_starter.V6.1/glexec_privsep_helper.linux.cpp
index 66f734d..0bf5cb8 100644
--- a/src/condor_starter.V6.1/glexec_privsep_helper.linux.cpp
+++ b/src/condor_starter.V6.1/glexec_privsep_helper.linux.cpp
@@ -156,11 +156,11 @@ GLExecPrivSepHelper::initialize(const char* proxy, const char* sandbox)
if (libexec == NULL) {
EXCEPT("GLExec: LIBEXEC not defined");
}
- m_setup_script.sprintf("%s/condor_glexec_setup", libexec);
- m_run_script.sprintf("%s/condor_glexec_run", libexec);
- m_wrapper_script.sprintf("%s/condor_glexec_job_wrapper", libexec);
- m_proxy_update_script.sprintf("%s/condor_glexec_update_proxy", libexec);
- m_cleanup_script.sprintf("%s/condor_glexec_cleanup", libexec);
+ m_setup_script.formatstr("%s/condor_glexec_setup", libexec);
+ m_run_script.formatstr("%s/condor_glexec_run", libexec);
+ m_wrapper_script.formatstr("%s/condor_glexec_job_wrapper", libexec);
+ m_proxy_update_script.formatstr("%s/condor_glexec_update_proxy", libexec);
+ m_cleanup_script.formatstr("%s/condor_glexec_cleanup", libexec);
free(libexec);
m_sandbox_owned_by_user = false;
@@ -324,7 +324,7 @@ GLExecPrivSepHelper::create_process(const char* path,
FamilyInfo fi;
FamilyInfo* fi_ptr = (family_info != NULL) ? family_info : &fi;
MyString proxy_path;
- proxy_path.sprintf("%s.condor/%s", m_sandbox, m_proxy);
+ proxy_path.formatstr("%s.condor/%s", m_sandbox, m_proxy);
fi_ptr->glexec_proxy = proxy_path.Value();
// At the very least, we need to pass the condor daemon's
diff --git a/src/condor_starter.V6.1/java_proc.cpp b/src/condor_starter.V6.1/java_proc.cpp
index 81e6761..f5e0ff7 100644
--- a/src/condor_starter.V6.1/java_proc.cpp
+++ b/src/condor_starter.V6.1/java_proc.cpp
@@ -100,8 +100,8 @@ int JavaProc::StartJob()
}
}
- startfile.sprintf("%s%cjvm.start",execute_dir,DIR_DELIM_CHAR);
- endfile.sprintf("%s%cjvm.end",execute_dir,DIR_DELIM_CHAR);
+ startfile.formatstr("%s%cjvm.start",execute_dir,DIR_DELIM_CHAR);
+ endfile.formatstr("%s%cjvm.end",execute_dir,DIR_DELIM_CHAR);
if( !java_config(java_cmd,&args,jarfiles_final_list) ) {
dprintf(D_FAILURE|D_ALWAYS,"JavaProc: Java is not configured!\n");
@@ -110,7 +110,7 @@ int JavaProc::StartJob()
JobAd->Assign(ATTR_JOB_CMD, java_cmd.Value());
- arg_buf.sprintf("-Dchirp.config=%s%cchirp.config",execute_dir,DIR_DELIM_CHAR);
+ arg_buf.formatstr("-Dchirp.config=%s%cchirp.config",execute_dir,DIR_DELIM_CHAR);
args.AppendArg(arg_buf.Value());
char *jvm_args1 = NULL;
diff --git a/src/condor_starter.V6.1/jic_local.cpp b/src/condor_starter.V6.1/jic_local.cpp
index 26bec5c..385dcb6 100644
--- a/src/condor_starter.V6.1/jic_local.cpp
+++ b/src/condor_starter.V6.1/jic_local.cpp
@@ -473,7 +473,7 @@ JICLocal::getJobStdFile( const char* attr_name )
}
if ( !nullFile(tmp) ) {
if( ! fullpath(tmp) ) {
- filename.sprintf( "%s%c", job_iwd, DIR_DELIM_CHAR );
+ filename.formatstr( "%s%c", job_iwd, DIR_DELIM_CHAR );
}
filename += tmp;
}
diff --git a/src/condor_starter.V6.1/jic_shadow.cpp b/src/condor_starter.V6.1/jic_shadow.cpp
index 8609dd2..9ed8f30 100644
--- a/src/condor_starter.V6.1/jic_shadow.cpp
+++ b/src/condor_starter.V6.1/jic_shadow.cpp
@@ -1471,7 +1471,7 @@ JICShadow::getJobStdFile( const char* attr_name )
base = tmp;
}
if( ! fullpath(base) ) { // prepend full path
- filename.sprintf( "%s%c", job_iwd, DIR_DELIM_CHAR );
+ filename.formatstr( "%s%c", job_iwd, DIR_DELIM_CHAR );
}
filename += base;
}
@@ -2109,7 +2109,7 @@ JICShadow::initIOProxy( void )
}
if( want_io_proxy || job_universe==CONDOR_UNIVERSE_JAVA ) {
- io_proxy_config_file.sprintf( "%s%cchirp.config",
+ io_proxy_config_file.formatstr( "%s%cchirp.config",
Starter->GetWorkingDir(), DIR_DELIM_CHAR );
if( !io_proxy.init(io_proxy_config_file.Value()) ) {
dprintf( D_FAILURE|D_ALWAYS,
diff --git a/src/condor_starter.V6.1/job_info_communicator.cpp b/src/condor_starter.V6.1/job_info_communicator.cpp
index dd5170c..5371c07 100644
--- a/src/condor_starter.V6.1/job_info_communicator.cpp
+++ b/src/condor_starter.V6.1/job_info_communicator.cpp
@@ -568,7 +568,7 @@ JobInfoCommunicator::checkDedicatedExecuteAccounts( char const *name )
// force the matching of the whole string
MyString full_pattern;
- full_pattern.sprintf("^%s$",pattern_string);
+ full_pattern.formatstr("^%s$",pattern_string);
Regex re;
char const *errstr = NULL;
diff --git a/src/condor_starter.V6.1/local_user_log.cpp b/src/condor_starter.V6.1/local_user_log.cpp
index 91b00ec..25bbaa2 100644
--- a/src/condor_starter.V6.1/local_user_log.cpp
+++ b/src/condor_starter.V6.1/local_user_log.cpp
@@ -98,13 +98,13 @@ LocalUserLog::initFromJobAd( ClassAd* ad, const char* path_attr,
// for the job, instead.
if( jic->iwdIsChanged() ) {
const char* base = condor_basename(tmp.Value());
- logfilename.sprintf( "%s/%s", iwd, base);
+ logfilename.formatstr( "%s/%s", iwd, base);
} else {
logfilename = tmp;
}
} else {
// no full path, so, use the job's iwd...
- logfilename.sprintf( "%s/%s", iwd, tmp.Value());
+ logfilename.formatstr( "%s/%s", iwd, tmp.Value());
}
ad->LookupBool( xml_attr, use_xml );
diff --git a/src/condor_starter.V6.1/os_proc.cpp b/src/condor_starter.V6.1/os_proc.cpp
index a22d098..9db8bed 100644
--- a/src/condor_starter.V6.1/os_proc.cpp
+++ b/src/condor_starter.V6.1/os_proc.cpp
@@ -122,14 +122,14 @@ OsProc::StartJob(FamilyInfo* family_info, FilesystemRemap* fs_remap=NULL)
dprintf(D_ALWAYS, "Preserving relative executable path: %s\n", JobName.Value());
}
else if ( strcmp(CONDOR_EXEC,JobName.Value()) == 0 ) {
- JobName.sprintf( "%s%c%s",
+ JobName.formatstr( "%s%c%s",
Starter->GetWorkingDir(),
DIR_DELIM_CHAR,
CONDOR_EXEC );
}
else if (relative_exe && job_iwd && *job_iwd) {
MyString full_name;
- full_name.sprintf("%s%c%s",
+ full_name.formatstr("%s%c%s",
job_iwd,
DIR_DELIM_CHAR,
JobName.Value());
@@ -378,7 +378,7 @@ OsProc::StartJob(FamilyInfo* family_info, FilesystemRemap* fs_remap=NULL)
args_string.Value() );
MyString wrapper_err;
- wrapper_err.sprintf("%s%c%s", Starter->GetWorkingDir(),
+ wrapper_err.formatstr("%s%c%s", Starter->GetWorkingDir(),
DIR_DELIM_CHAR,
JOB_WRAPPER_FAILURE_FILE);
if( ! job_env.SetEnv("_CONDOR_WRAPPER_ERROR_FILE", wrapper_err.Value()) ) {
@@ -390,14 +390,14 @@ OsProc::StartJob(FamilyInfo* family_info, FilesystemRemap* fs_remap=NULL)
}
MyString path;
- path.sprintf("%s%c%s", Starter->GetWorkingDir(),
+ path.formatstr("%s%c%s", Starter->GetWorkingDir(),
DIR_DELIM_CHAR,
MACHINE_AD_FILENAME);
if( ! job_env.SetEnv("_CONDOR_MACHINE_AD", path.Value()) ) {
dprintf( D_ALWAYS, "Failed to set _CONDOR_MACHINE_AD environment variable\n");
}
- path.sprintf("%s%c%s", Starter->GetWorkingDir(),
+ path.formatstr("%s%c%s", Starter->GetWorkingDir(),
DIR_DELIM_CHAR,
JOB_AD_FILENAME);
if( ! job_env.SetEnv("_CONDOR_JOB_AD", path.Value()) ) {
@@ -574,7 +574,7 @@ OsProc::StartJob(FamilyInfo* family_info, FilesystemRemap* fs_remap=NULL)
if ((FALSE == JobPid) && (0 != create_process_errno)) {
if (create_process_err_msg != "") create_process_err_msg += " ";
MyString errbuf;
- errbuf.sprintf("(errno=%d: '%s')", create_process_errno, strerror(create_process_errno));
+ errbuf.formatstr("(errno=%d: '%s')", create_process_errno, strerror(create_process_errno));
create_process_err_msg += errbuf;
}
@@ -722,7 +722,7 @@ OsProc::checkCoreFile( void )
// Since Linux now writes out "core.pid" by default, we should
// search for that. Try the JobPid of our first child:
MyString name_with_pid;
- name_with_pid.sprintf( "core.%d", JobPid );
+ name_with_pid.formatstr( "core.%d", JobPid );
if (Starter->privSepHelper() != NULL) {
@@ -740,7 +740,7 @@ OsProc::checkCoreFile( void )
}
else {
MyString new_name;
- new_name.sprintf( "core.%d.%d",
+ new_name.formatstr( "core.%d.%d",
Starter->jic->jobCluster(),
Starter->jic->jobProc() );
@@ -780,8 +780,8 @@ OsProc::renameCoreFile( const char* old_name, const char* new_name )
MyString old_full;
MyString new_full;
const char* job_iwd = Starter->jic->jobIWD();
- old_full.sprintf( "%s%c%s", job_iwd, DIR_DELIM_CHAR, old_name );
- new_full.sprintf( "%s%c%s", job_iwd, DIR_DELIM_CHAR, new_name );
+ old_full.formatstr( "%s%c%s", job_iwd, DIR_DELIM_CHAR, old_name );
+ new_full.formatstr( "%s%c%s", job_iwd, DIR_DELIM_CHAR, new_name );
priv_state old_priv;
@@ -891,22 +891,22 @@ OsProc::PublishUpdateAd( ClassAd* ad )
MyString buf;
if (m_proc_exited) {
- buf.sprintf( "%s=\"Exited\"", ATTR_JOB_STATE );
+ buf.formatstr( "%s=\"Exited\"", ATTR_JOB_STATE );
} else if( is_checkpointed ) {
- buf.sprintf( "%s=\"Checkpointed\"", ATTR_JOB_STATE );
+ buf.formatstr( "%s=\"Checkpointed\"", ATTR_JOB_STATE );
} else if( is_suspended ) {
- buf.sprintf( "%s=\"Suspended\"", ATTR_JOB_STATE );
+ buf.formatstr( "%s=\"Suspended\"", ATTR_JOB_STATE );
} else {
- buf.sprintf( "%s=\"Running\"", ATTR_JOB_STATE );
+ buf.formatstr( "%s=\"Running\"", ATTR_JOB_STATE );
}
ad->Insert( buf.Value() );
- buf.sprintf( "%s=%d", ATTR_NUM_PIDS, num_pids );
+ buf.formatstr( "%s=%d", ATTR_NUM_PIDS, num_pids );
ad->Insert( buf.Value() );
if (m_proc_exited) {
if( dumped_core ) {
- buf.sprintf( "%s = True", ATTR_JOB_CORE_DUMPED );
+ buf.formatstr( "%s = True", ATTR_JOB_CORE_DUMPED );
ad->Insert( buf.Value() );
} // should we put in ATTR_JOB_CORE_DUMPED = false if not?
}
@@ -930,7 +930,7 @@ OsProc::makeCpuAffinityMask(int slotId) {
MyString affinityParam;
- affinityParam.sprintf("SLOT%d_CPU_AFFINITY", slotId);
+ affinityParam.formatstr("SLOT%d_CPU_AFFINITY", slotId);
char *affinityParamResult = param(affinityParam.Value());
if (affinityParamResult == NULL) {
diff --git a/src/condor_starter.V6.1/tool_daemon_proc.cpp b/src/condor_starter.V6.1/tool_daemon_proc.cpp
index c61d483..04bb718 100644
--- a/src/condor_starter.V6.1/tool_daemon_proc.cpp
+++ b/src/condor_starter.V6.1/tool_daemon_proc.cpp
@@ -75,10 +75,10 @@ ToolDaemonProc::StartJob()
const char* base = NULL;
base = condor_basename( tmp );
if( Starter->jic->iwdIsChanged() ) {
- DaemonNameStr.sprintf( "%s%c%s", Starter->GetWorkingDir(),
+ DaemonNameStr.formatstr( "%s%c%s", Starter->GetWorkingDir(),
DIR_DELIM_CHAR, base );
} else if( ! fullpath(tmp) ) {
- DaemonNameStr.sprintf( "%s%c%s", job_iwd, DIR_DELIM_CHAR, tmp );
+ DaemonNameStr.formatstr( "%s%c%s", job_iwd, DIR_DELIM_CHAR, tmp );
} else {
DaemonNameStr = tmp;
}
@@ -310,7 +310,7 @@ ToolDaemonProc::StartJob()
JobPid = -1;
if( create_process_error ) {
MyString err_msg;
- err_msg.sprintf( "Failed to execute '%s': %s",
+ err_msg.formatstr( "Failed to execute '%s': %s",
args_string.Value(), create_process_error );
Starter->jic->notifyStarterError( err_msg.Value(), true, CONDOR_HOLD_CODE_FailedToCreateProcess, create_process_errno );
}
diff --git a/src/condor_starter.V6.1/user_proc.cpp b/src/condor_starter.V6.1/user_proc.cpp
index 8f35174..191414c 100644
--- a/src/condor_starter.V6.1/user_proc.cpp
+++ b/src/condor_starter.V6.1/user_proc.cpp
@@ -118,7 +118,7 @@ UserProc::JobReaper(int pid, int status)
dprintf( D_FULLDEBUG, "Inside UserProc::JobReaper()\n" );
- filename.sprintf("%s%c%s", dir, DIR_DELIM_CHAR, JOB_WRAPPER_FAILURE_FILE);
+ filename.formatstr("%s%c%s", dir, DIR_DELIM_CHAR, JOB_WRAPPER_FAILURE_FILE);
if (0 == access(filename.Value(), F_OK)) {
// The job wrapper failed, so read the contents of the file
// and EXCEPT, just as is done when an executable is unable
@@ -351,7 +351,7 @@ UserProc::getStdFile( std_file_type type,
StreamHandler *handler = new StreamHandler;
if( !handler->Init(filename, stream_name, is_output) ) {
MyString err_msg;
- err_msg.sprintf( "unable to establish %s stream", phrase );
+ err_msg.formatstr( "unable to establish %s stream", phrase );
Starter->jic->notifyStarterError( err_msg.Value(), true,
is_output ? CONDOR_HOLD_CODE_UnableToOpenOutputStream :
CONDOR_HOLD_CODE_UnableToOpenInputStream, 0 );
@@ -448,7 +448,7 @@ UserProc::openStdFile( std_file_type type,
else {
phrase = "standard error";
}
- err_msg.sprintf( "Failed to open '%s' as %s: %s (errno %d)",
+ err_msg.formatstr( "Failed to open '%s' as %s: %s (errno %d)",
filename.Value(),
phrase,
errno_str,
diff --git a/src/condor_starter.V6.1/vm_gahp_request.cpp b/src/condor_starter.V6.1/vm_gahp_request.cpp
index 6399bba..024bb0f 100644
--- a/src/condor_starter.V6.1/vm_gahp_request.cpp
+++ b/src/condor_starter.V6.1/vm_gahp_request.cpp
@@ -200,7 +200,7 @@ VMGahpRequest::vmStart(const char *vm_type, const char *workingdir)
}
MyString reqline;
- reqline.sprintf("%s", vm_type);
+ reqline.formatstr("%s", vm_type);
//Now sending a command to vm-gahp
//Req_id is gonna be set in nowPending function
@@ -306,7 +306,7 @@ VMGahpRequest::executeBasicCmd(const char *command, int vm_id)
}
MyString reqline;
- reqline.sprintf("%d", vm_id);
+ reqline.formatstr("%d", vm_id);
//Now sending a command to vm-gahp
//Req_id is gonna be set in nowPending function
diff --git a/src/condor_starter.V6.1/vm_gahp_server.cpp b/src/condor_starter.V6.1/vm_gahp_server.cpp
index e6f989c..e010eae 100644
--- a/src/condor_starter.V6.1/vm_gahp_server.cpp
+++ b/src/condor_starter.V6.1/vm_gahp_server.cpp
@@ -330,9 +330,9 @@ VMGahpServer::startUp(Env *job_env, const char *workingdir, int nice_inc, Family
}
MyString tmp_str;
- tmp_str.sprintf("%d", (int)vmgahp_user_uid);
+ tmp_str.formatstr("%d", (int)vmgahp_user_uid);
job_env->SetEnv("VMGAHP_USER_UID", tmp_str.Value());
- tmp_str.sprintf("%d", (int)vmgahp_user_gid);
+ tmp_str.formatstr("%d", (int)vmgahp_user_gid);
job_env->SetEnv("VMGAHP_USER_GID", tmp_str.Value());
}
#endif
@@ -800,7 +800,7 @@ VMGahpServer::write_line(const char *command)
}
MyString debug;
- debug.sprintf( "'%s'", command );
+ debug.formatstr( "'%s'", command );
dprintf( D_FULLDEBUG, "VMGAHP[%d] <- %s\n", m_vmgahp_pid,
debug.Value() );
@@ -819,7 +819,7 @@ VMGahpServer::write_line(const char *command, int req, const char *args)
}
MyString buf;
- buf.sprintf(" %d ",req);
+ buf.formatstr(" %d ",req);
if( daemonCore->Write_Pipe(m_vmgahp_writefd,command,strlen(command)) <= 0 ) {
dprintf( D_ALWAYS, "VMGAHP write line(%s) Error\n", command);
return false;
@@ -841,9 +841,9 @@ VMGahpServer::write_line(const char *command, int req, const char *args)
MyString debug;
if( args ) {
- debug.sprintf( "'%s%s%s'", command, buf.Value(), args );
+ debug.formatstr( "'%s%s%s'", command, buf.Value(), args );
} else {
- debug.sprintf( "'%s%s'", command, buf.Value() );
+ debug.formatstr( "'%s%s'", command, buf.Value() );
}
dprintf( D_FULLDEBUG, "VMGAHP[%d] <- %s\n", m_vmgahp_pid,
debug.Value() );
@@ -1368,7 +1368,7 @@ VMGahpServer::publishVMClassAd(const char *workingdir)
// Send Working directory
MyString vmAttr;
- vmAttr.sprintf("VM_WORKING_DIR = \"%s\"", workingdir);
+ vmAttr.formatstr("VM_WORKING_DIR = \"%s\"", workingdir);
if ( write_line( vmAttr.Value() ) == false ) {
return false;
@@ -1413,7 +1413,7 @@ VMGahpServer::publishVMClassAd(const char *workingdir)
continue;
}
- vmAttr.sprintf( "%s = %s", name, ExprTreeToString( expr ) );
+ vmAttr.formatstr( "%s = %s", name, ExprTreeToString( expr ) );
if ( write_line( vmAttr.Value() ) == false ) {
return false;
@@ -1498,12 +1498,12 @@ VMGahpServer::killVM(void)
#if !defined(WIN32)
if( can_switch_ids() ) {
MyString tmp_str;
- tmp_str.sprintf("%d", (int)get_condor_uid());
+ tmp_str.formatstr("%d", (int)get_condor_uid());
SetEnv("VMGAHP_USER_UID", tmp_str.Value());
}
else if (Starter->condorPrivSepHelper() != NULL) {
MyString tmp_str;
- tmp_str.sprintf("%d", (int)Starter->condorPrivSepHelper()->get_uid());
+ tmp_str.formatstr("%d", (int)Starter->condorPrivSepHelper()->get_uid());
SetEnv("VMGAHP_USER_UID", tmp_str.Value());
}
#endif
diff --git a/src/condor_starter.V6.1/vm_proc.cpp b/src/condor_starter.V6.1/vm_proc.cpp
index 3c38590..8bb8abf 100644
--- a/src/condor_starter.V6.1/vm_proc.cpp
+++ b/src/condor_starter.V6.1/vm_proc.cpp
@@ -273,7 +273,7 @@ VMProc::StartJob()
// Get job name
MyString vm_job_name;
if( JobAd->LookupString( ATTR_JOB_CMD, vm_job_name) != 1 ) {
- err_msg.sprintf("%s cannot be found in job classAd.", ATTR_JOB_CMD);
+ err_msg.formatstr("%s cannot be found in job classAd.", ATTR_JOB_CMD);
dprintf(D_ALWAYS, "%s\n", err_msg.Value());
Starter->jic->notifyStarterError( err_msg.Value(), true,
CONDOR_HOLD_CODE_FailedToCreateProcess, 0);
@@ -284,7 +284,7 @@ VMProc::StartJob()
// vm_type should be from ClassAd
MyString vm_type_name;
if( JobAd->LookupString( ATTR_JOB_VM_TYPE, vm_type_name) != 1 ) {
- err_msg.sprintf("%s cannot be found in job classAd.", ATTR_JOB_VM_TYPE);
+ err_msg.formatstr("%s cannot be found in job classAd.", ATTR_JOB_VM_TYPE);
dprintf(D_ALWAYS, "%s\n", err_msg.Value());
Starter->jic->notifyStarterError( err_msg.Value(), true,
CONDOR_HOLD_CODE_FailedToCreateProcess, 0);
@@ -1230,9 +1230,9 @@ VMProc::PublishUpdateAd( ClassAd* ad )
ad->Assign(ATTR_JOB_REMOTE_SYS_CPU, float(sys_time));
ad->Assign(ATTR_JOB_REMOTE_USER_CPU, float(user_time));
- buf.sprintf("%s=%lu", ATTR_IMAGE_SIZE, max_image );
+ buf.formatstr("%s=%lu", ATTR_IMAGE_SIZE, max_image );
ad->InsertOrUpdate( buf.Value());
- buf.sprintf("%s=%lu", ATTR_RESIDENT_SET_SIZE, rss );
+ buf.formatstr("%s=%lu", ATTR_RESIDENT_SET_SIZE, rss );
ad->InsertOrUpdate( buf.Value());
if( pss_available ) {
ad->Assign(ATTR_PROPORTIONAL_SET_SIZE,pss);
diff --git a/src/condor_status.V6/status.cpp b/src/condor_status.V6/status.cpp
index 988a395..add55b7 100644
--- a/src/condor_status.V6/status.cpp
+++ b/src/condor_status.V6/status.cpp
@@ -1006,7 +1006,7 @@ secondPass (int argc, char *argv[])
opts = FormatOptionAutoWidth | FormatOptionNoTruncate;
pm_head.Append(hd);
}
- else if (flabel) { lbl.sprintf("%s = ", argv[i]); wid = 0; opts = 0; }
+ else if (flabel) { lbl.formatstr("%s = ", argv[i]); wid = 0; opts = 0; }
lbl += fCapV ? "%V" : "%v";
if (diagnose) {
printf ("Arg %d --- register format [%s] width=%d, opt=0x%x for [%s]\n",
diff --git a/src/condor_submit.V6/submit.cpp b/src/condor_submit.V6/submit.cpp
index 0349839..47c5e78 100644
--- a/src/condor_submit.V6/submit.cpp
+++ b/src/condor_submit.V6/submit.cpp
@@ -742,13 +742,13 @@ init_job_ad()
job->SetTargetTypeName (STARTD_ADTYPE);
}
- buffer.sprintf( "%s = %d", ATTR_Q_DATE, (int)time ((time_t *) 0));
+ buffer.formatstr( "%s = %d", ATTR_Q_DATE, (int)time ((time_t *) 0));
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_COMPLETION_DATE);
+ buffer.formatstr( "%s = 0", ATTR_COMPLETION_DATE);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = \"%s\"", ATTR_OWNER, owner);
+ buffer.formatstr( "%s = \"%s\"", ATTR_OWNER, owner);
InsertJobExpr (buffer);
#ifdef WIN32
@@ -801,58 +801,58 @@ init_job_ad()
}
#endif
- buffer.sprintf( "%s = 0.0", ATTR_JOB_REMOTE_WALL_CLOCK);
+ buffer.formatstr( "%s = 0.0", ATTR_JOB_REMOTE_WALL_CLOCK);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0.0", ATTR_JOB_LOCAL_USER_CPU);
+ buffer.formatstr( "%s = 0.0", ATTR_JOB_LOCAL_USER_CPU);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0.0", ATTR_JOB_LOCAL_SYS_CPU);
+ buffer.formatstr( "%s = 0.0", ATTR_JOB_LOCAL_SYS_CPU);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0.0", ATTR_JOB_REMOTE_USER_CPU);
+ buffer.formatstr( "%s = 0.0", ATTR_JOB_REMOTE_USER_CPU);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0.0", ATTR_JOB_REMOTE_SYS_CPU);
+ buffer.formatstr( "%s = 0.0", ATTR_JOB_REMOTE_SYS_CPU);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_JOB_EXIT_STATUS);
+ buffer.formatstr( "%s = 0", ATTR_JOB_EXIT_STATUS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_NUM_CKPTS);
+ buffer.formatstr( "%s = 0", ATTR_NUM_CKPTS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_NUM_JOB_STARTS);
+ buffer.formatstr( "%s = 0", ATTR_NUM_JOB_STARTS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_NUM_RESTARTS);
+ buffer.formatstr( "%s = 0", ATTR_NUM_RESTARTS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_NUM_SYSTEM_HOLDS);
+ buffer.formatstr( "%s = 0", ATTR_NUM_SYSTEM_HOLDS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_JOB_COMMITTED_TIME);
+ buffer.formatstr( "%s = 0", ATTR_JOB_COMMITTED_TIME);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_COMMITTED_SLOT_TIME);
+ buffer.formatstr( "%s = 0", ATTR_COMMITTED_SLOT_TIME);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_CUMULATIVE_SLOT_TIME);
+ buffer.formatstr( "%s = 0", ATTR_CUMULATIVE_SLOT_TIME);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_TOTAL_SUSPENSIONS);
+ buffer.formatstr( "%s = 0", ATTR_TOTAL_SUSPENSIONS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_LAST_SUSPENSION_TIME);
+ buffer.formatstr( "%s = 0", ATTR_LAST_SUSPENSION_TIME);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_CUMULATIVE_SUSPENSION_TIME);
+ buffer.formatstr( "%s = 0", ATTR_CUMULATIVE_SUSPENSION_TIME);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_COMMITTED_SUSPENSION_TIME);
+ buffer.formatstr( "%s = 0", ATTR_COMMITTED_SUSPENSION_TIME);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = FALSE", ATTR_ON_EXIT_BY_SIGNAL);
+ buffer.formatstr( "%s = FALSE", ATTR_ON_EXIT_BY_SIGNAL);
InsertJobExpr (buffer);
config_fill_ad( job );
@@ -1681,7 +1681,7 @@ SetExecutable()
macro_value = condor_param( TransferExecutable, ATTR_TRANSFER_EXECUTABLE );
if ( macro_value ) {
if ( macro_value[0] == 'F' || macro_value[0] == 'f' ) {
- buffer.sprintf( "%s = FALSE", ATTR_TRANSFER_EXECUTABLE );
+ buffer.formatstr( "%s = FALSE", ATTR_TRANSFER_EXECUTABLE );
InsertJobExpr( buffer );
transfer_it = false;
}
@@ -1690,7 +1690,7 @@ SetExecutable()
if ( ignore_it ) {
if( transfer_it == true ) {
- buffer.sprintf( "%s = FALSE", ATTR_TRANSFER_EXECUTABLE );
+ buffer.formatstr( "%s = FALSE", ATTR_TRANSFER_EXECUTABLE );
InsertJobExpr( buffer );
transfer_it = false;
}
@@ -1707,7 +1707,7 @@ SetExecutable()
check_and_universalize_path(full_ename);
}
- buffer.sprintf( "%s = \"%s\"", ATTR_JOB_CMD, full_ename.Value());
+ buffer.formatstr( "%s = \"%s\"", ATTR_JOB_CMD, full_ename.Value());
InsertJobExpr (buffer);
/* MPI REALLY doesn't like these! */
@@ -1718,7 +1718,7 @@ SetExecutable()
if ( JobUniverse == CONDOR_UNIVERSE_PARALLEL) {
InsertJobExpr ("WantIOProxy = TRUE");
- buffer.sprintf("%s = TRUE", ATTR_JOB_REQUIRES_SANDBOX);
+ buffer.formatstr("%s = TRUE", ATTR_JOB_REQUIRES_SANDBOX);
InsertJobExpr (buffer);
}
@@ -1727,9 +1727,9 @@ SetExecutable()
switch(JobUniverse)
{
case CONDOR_UNIVERSE_STANDARD:
- buffer.sprintf( "%s = TRUE", ATTR_WANT_REMOTE_SYSCALLS);
+ buffer.formatstr( "%s = TRUE", ATTR_WANT_REMOTE_SYSCALLS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = TRUE", ATTR_WANT_CHECKPOINT);
+ buffer.formatstr( "%s = TRUE", ATTR_WANT_CHECKPOINT);
InsertJobExpr (buffer);
break;
case CONDOR_UNIVERSE_VANILLA:
@@ -1740,9 +1740,9 @@ SetExecutable()
case CONDOR_UNIVERSE_GRID:
case CONDOR_UNIVERSE_JAVA:
case CONDOR_UNIVERSE_VM:
- buffer.sprintf( "%s = FALSE", ATTR_WANT_REMOTE_SYSCALLS);
+ buffer.formatstr( "%s = FALSE", ATTR_WANT_REMOTE_SYSCALLS);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = FALSE", ATTR_WANT_CHECKPOINT);
+ buffer.formatstr( "%s = FALSE", ATTR_WANT_CHECKPOINT);
InsertJobExpr (buffer);
break;
default:
@@ -1897,7 +1897,7 @@ SetUniverse()
if( univ && strcasecmp(univ,"scheduler") == MATCH ) {
JobUniverse = CONDOR_UNIVERSE_SCHEDULER;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_SCHEDULER);
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_SCHEDULER);
InsertJobExpr (buffer);
free(univ);
return;
@@ -1905,7 +1905,7 @@ SetUniverse()
if( univ && strcasecmp(univ,"local") == MATCH ) {
JobUniverse = CONDOR_UNIVERSE_LOCAL;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE,
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE,
CONDOR_UNIVERSE_LOCAL );
InsertJobExpr( buffer );
free( univ );
@@ -1916,7 +1916,7 @@ SetUniverse()
((strcasecmp(univ,"globus") == MATCH) || (strcasecmp(univ,"grid") == MATCH))) {
JobUniverse = CONDOR_UNIVERSE_GRID;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_GRID);
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_GRID);
InsertJobExpr (buffer);
free(univ);
univ = 0;
@@ -1990,7 +1990,7 @@ SetUniverse()
if( univ && strcasecmp(univ,"parallel") == MATCH ) {
JobUniverse = CONDOR_UNIVERSE_PARALLEL;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_PARALLEL);
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_PARALLEL);
InsertJobExpr (buffer);
free(univ);
@@ -1999,7 +1999,7 @@ SetUniverse()
if( univ && strcasecmp(univ,"vanilla") == MATCH ) {
JobUniverse = CONDOR_UNIVERSE_VANILLA;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_VANILLA);
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_VANILLA);
InsertJobExpr (buffer);
free(univ);
return;
@@ -2007,7 +2007,7 @@ SetUniverse()
if( univ && strcasecmp(univ,"mpi") == MATCH ) {
JobUniverse = CONDOR_UNIVERSE_MPI;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_MPI);
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_MPI);
InsertJobExpr (buffer);
free(univ);
@@ -2016,7 +2016,7 @@ SetUniverse()
if( univ && strcasecmp(univ,"java") == MATCH ) {
JobUniverse = CONDOR_UNIVERSE_JAVA;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_JAVA);
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_JAVA);
InsertJobExpr (buffer);
free(univ);
return;
@@ -2024,7 +2024,7 @@ SetUniverse()
if( univ && strcasecmp(univ,"vm") == MATCH ) {
JobUniverse = CONDOR_UNIVERSE_VM;
- buffer.sprintf( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_VM);
+ buffer.formatstr( "%s = %d", ATTR_JOB_UNIVERSE, CONDOR_UNIVERSE_VM);
InsertJobExpr (buffer);
free(univ);
@@ -2156,7 +2156,7 @@ SetMachineCount()
wantParallelString = condor_param("WantParallelScheduling");
if (wantParallelString && (wantParallelString[0] == 'T' || wantParallelString[0] == 't')) {
wantParallel = true;
- buffer.sprintf(" WantParallelScheduling = true");
+ buffer.formatstr(" WantParallelScheduling = true");
InsertJobExpr (buffer);
}
@@ -2179,9 +2179,9 @@ SetMachineCount()
exit( 1 );
}
- buffer.sprintf( "%s = %d", ATTR_MIN_HOSTS, tmp);
+ buffer.formatstr( "%s = %d", ATTR_MIN_HOSTS, tmp);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = %d", ATTR_MAX_HOSTS, tmp);
+ buffer.formatstr( "%s = %d", ATTR_MAX_HOSTS, tmp);
InsertJobExpr (buffer);
request_cpus = 1;
@@ -2198,7 +2198,7 @@ SetMachineCount()
exit( 1 );
}
- buffer.sprintf( "%s = %d", ATTR_MACHINE_COUNT, tmp);
+ buffer.formatstr( "%s = %d", ATTR_MACHINE_COUNT, tmp);
InsertJobExpr (buffer);
request_cpus = tmp;
@@ -2210,21 +2210,21 @@ SetMachineCount()
if (MATCH == strcasecmp(mach_count, "undefined")) {
RequestCpusIsZeroOrOne = true;
} else {
- buffer.sprintf("%s = %s", ATTR_REQUEST_CPUS, mach_count);
+ buffer.formatstr("%s = %s", ATTR_REQUEST_CPUS, mach_count);
InsertJobExpr(buffer);
RequestCpusIsZeroOrOne = ((MATCH == strcmp(mach_count, "0")) || (MATCH == strcmp(mach_count, "1")));
}
free(mach_count);
} else
if (request_cpus > 0) {
- buffer.sprintf("%s = %d", ATTR_REQUEST_CPUS, request_cpus);
+ buffer.formatstr("%s = %d", ATTR_REQUEST_CPUS, request_cpus);
InsertJobExpr(buffer);
} else
if ((mach_count = param("JOB_DEFAULT_REQUESTCPUS"))) {
if (MATCH == strcasecmp(mach_count, "undefined")) {
RequestCpusIsZeroOrOne = true;
} else {
- buffer.sprintf("%s = %s", ATTR_REQUEST_CPUS, mach_count);
+ buffer.formatstr("%s = %s", ATTR_REQUEST_CPUS, mach_count);
InsertJobExpr(buffer);
RequestCpusIsZeroOrOne = ((MATCH == strcmp(mach_count, "0")) || (MATCH == strcmp(mach_count, "1")));
}
@@ -2283,10 +2283,10 @@ SetSimpleJobExprs()
if( i->quote_it ) {
MyString expr_buf;
ClassAd::EscapeStringValue( expr, expr_buf );
- buffer.sprintf( "%s = \"%s\"", i->ad_attr_name, expr_buf.Value());
+ buffer.formatstr( "%s = \"%s\"", i->ad_attr_name, expr_buf.Value());
}
else {
- buffer.sprintf( "%s = %s", i->ad_attr_name, expr);
+ buffer.formatstr( "%s = %s", i->ad_attr_name, expr);
}
InsertJobExpr (buffer);
@@ -2353,10 +2353,10 @@ SetImageSize()
// the requirements line, but that caused many problems.
// Jeff Ballard 11/4/98
- buffer.sprintf( "%s = %"PRId64, ATTR_IMAGE_SIZE, image_size_kb);
+ buffer.formatstr( "%s = %"PRId64, ATTR_IMAGE_SIZE, image_size_kb);
InsertJobExpr (buffer);
- buffer.sprintf( "%s = %"PRId64, ATTR_EXECUTABLE_SIZE, executable_size_kb);
+ buffer.formatstr( "%s = %"PRId64, ATTR_EXECUTABLE_SIZE, executable_size_kb);
InsertJobExpr (buffer);
// set an initial value for memory usage
@@ -2371,7 +2371,7 @@ SetImageSize()
exit( 1 );
}
free(tmp);
- buffer.sprintf( "%s = %"PRId64, ATTR_MEMORY_USAGE, memory_usage_mb);
+ buffer.formatstr( "%s = %"PRId64, ATTR_MEMORY_USAGE, memory_usage_mb);
InsertJobExpr (buffer);
}
@@ -2393,7 +2393,7 @@ SetImageSize()
// For non-vm jobs, VMMemoryMb is 0.
disk_usage_kb = executable_size_kb + TransferInputSizeKb + (int64_t)VMMemoryMb*1024;
}
- buffer.sprintf( "%s = %"PRId64, ATTR_DISK_USAGE, disk_usage_kb );
+ buffer.formatstr( "%s = %"PRId64, ATTR_DISK_USAGE, disk_usage_kb );
InsertJobExpr (buffer);
// set an intial value for RequestMemory
@@ -2404,25 +2404,25 @@ SetImageSize()
// and insert it as text into the jobAd.
int64_t req_memory_mb = 0;
if (parse_int64_bytes(tmp, req_memory_mb, 1024*1024)) {
- buffer.sprintf("%s = %"PRId64, ATTR_REQUEST_MEMORY, req_memory_mb);
+ buffer.formatstr("%s = %"PRId64, ATTR_REQUEST_MEMORY, req_memory_mb);
RequestMemoryIsZero = (req_memory_mb == 0);
} else if (MATCH == strcasecmp(tmp,"undefined")) {
RequestMemoryIsZero = true;
} else {
- buffer.sprintf("%s = %s", ATTR_REQUEST_MEMORY, tmp);
+ buffer.formatstr("%s = %s", ATTR_REQUEST_MEMORY, tmp);
}
free(tmp);
InsertJobExpr(buffer);
} else if ( (tmp = condor_param(VM_Memory, ATTR_JOB_VM_MEMORY)) ) {
fprintf(stderr, "\nNOTE: '%s' was NOT specified. Using %s = %s. \n", ATTR_REQUEST_MEMORY,ATTR_JOB_VM_MEMORY, tmp );
- buffer.sprintf("%s = MY.%s", ATTR_REQUEST_MEMORY, ATTR_JOB_VM_MEMORY);
+ buffer.formatstr("%s = MY.%s", ATTR_REQUEST_MEMORY, ATTR_JOB_VM_MEMORY);
free(tmp);
InsertJobExpr(buffer);
} else if ( (tmp = param("JOB_DEFAULT_REQUESTMEMORY")) ) {
if (MATCH == strcasecmp(tmp,"undefined")) {
RequestMemoryIsZero = true;
} else {
- buffer.sprintf("%s = %s", ATTR_REQUEST_MEMORY, tmp);
+ buffer.formatstr("%s = %s", ATTR_REQUEST_MEMORY, tmp);
RequestMemoryIsZero = (MATCH == strcmp(tmp, "0"));
InsertJobExpr(buffer);
}
@@ -2436,12 +2436,12 @@ SetImageSize()
// and insert it as text into the jobAd.
int64_t req_disk_kb = 0;
if (parse_int64_bytes(tmp, req_disk_kb, 1024)) {
- buffer.sprintf("%s = %"PRId64, ATTR_REQUEST_DISK, req_disk_kb);
+ buffer.formatstr("%s = %"PRId64, ATTR_REQUEST_DISK, req_disk_kb);
RequestDiskIsZero = (req_disk_kb == 0);
} else if (MATCH == strcasecmp(tmp,"undefined")) {
RequestDiskIsZero = true;
} else {
- buffer.sprintf("%s = %s", ATTR_REQUEST_DISK, tmp);
+ buffer.formatstr("%s = %s", ATTR_REQUEST_DISK, tmp);
}
free(tmp);
InsertJobExpr(buffer);
@@ -2449,7 +2449,7 @@ SetImageSize()
if (MATCH == strcasecmp(tmp,"undefined")) {
RequestDiskIsZero = true;
} else {
- buffer.sprintf("%s = %s", ATTR_REQUEST_DISK, tmp);
+ buffer.formatstr("%s = %s", ATTR_REQUEST_DISK, tmp);
RequestDiskIsZero = (MATCH == strcmp(tmp, "0"));
InsertJobExpr(buffer);
}
@@ -2465,14 +2465,14 @@ void SetFileOptions()
tmp = condor_param( FileRemaps, ATTR_FILE_REMAPS );
if(tmp) {
- strbuffer.sprintf("%s = %s",ATTR_FILE_REMAPS,tmp);
+ strbuffer.formatstr("%s = %s",ATTR_FILE_REMAPS,tmp);
InsertJobExpr(strbuffer);
free(tmp);
}
tmp = condor_param( BufferFiles, ATTR_BUFFER_FILES );
if(tmp) {
- strbuffer.sprintf("%s = %s",ATTR_BUFFER_FILES,tmp);
+ strbuffer.formatstr("%s = %s",ATTR_BUFFER_FILES,tmp);
InsertJobExpr(strbuffer);
free(tmp);
}
@@ -2486,7 +2486,7 @@ void SetFileOptions()
tmp = strdup("524288");
}
}
- strbuffer.sprintf("%s = %s",ATTR_BUFFER_SIZE,tmp);
+ strbuffer.formatstr("%s = %s",ATTR_BUFFER_SIZE,tmp);
InsertJobExpr(strbuffer);
free(tmp);
@@ -2499,7 +2499,7 @@ void SetFileOptions()
tmp = strdup("32768");
}
}
- strbuffer.sprintf("%s = %s",ATTR_BUFFER_BLOCK_SIZE,tmp);
+ strbuffer.formatstr("%s = %s",ATTR_BUFFER_BLOCK_SIZE,tmp);
InsertJobExpr(strbuffer.Value());
free(tmp);
}
@@ -2576,7 +2576,7 @@ process_input_file_list(StringList * input_list, MyString *input_files, bool * f
}
if ( count ) {
tmp_ptr = input_list->print_to_string();
- input_files->sprintf( "%s = \"%s\"",
+ input_files->formatstr( "%s = \"%s\"",
ATTR_TRANSFER_INPUT_FILES, tmp_ptr );
free( tmp_ptr );
*files_specified = true;
@@ -2670,7 +2670,7 @@ SetTransferFiles()
}
tmp_ptr = output_file_list.print_to_string();
if ( count ) {
- (void) output_files.sprintf ("%s = \"%s\"",
+ (void) output_files.formatstr ("%s = \"%s\"",
ATTR_TRANSFER_OUTPUT_FILES, tmp_ptr);
free(tmp_ptr);
tmp_ptr = NULL;
@@ -2920,7 +2920,7 @@ SetTransferFiles()
InsertJobExprString( ATTR_JOB_CMD, "java");
MyString b;
- b.sprintf("%s = FALSE", ATTR_TRANSFER_EXECUTABLE);
+ b.formatstr("%s = FALSE", ATTR_TRANSFER_EXECUTABLE);
InsertJobExpr( b.Value() );
}
@@ -3043,7 +3043,7 @@ SetTransferFiles()
if(!output_remaps.IsEmpty()) {
MyString expr;
- expr.sprintf("%s = \"%s\"",ATTR_TRANSFER_OUTPUT_REMAPS,output_remaps.Value());
+ expr.formatstr("%s = \"%s\"",ATTR_TRANSFER_OUTPUT_REMAPS,output_remaps.Value());
InsertJobExpr(expr);
}
@@ -3079,7 +3079,7 @@ void FixupTransferInputFiles( void )
if( Remote && !FileTransfer::ExpandInputFileList( job, error_msg ) )
{
MyString err_msg;
- err_msg.sprintf( "\n%s\n",error_msg.Value());
+ err_msg.formatstr( "\n%s\n",error_msg.Value());
print_wrapped_text( err_msg.Value(), stderr );
DoCleanup(0,0,NULL);
exit( 1 );
@@ -3263,7 +3263,7 @@ SetJavaVMArgs()
if( MyCondorVersionRequiresV1 ) {
args_success = args.GetArgsStringV1Raw(&value,&error_msg);
if(!value.IsEmpty()) {
- strbuffer.sprintf("%s = \"%s\"",ATTR_JOB_JAVA_VM_ARGS1,
+ strbuffer.formatstr("%s = \"%s\"",ATTR_JOB_JAVA_VM_ARGS1,
value.EscapeChars("\"",'\\').Value());
InsertJobExpr (strbuffer);
}
@@ -3271,7 +3271,7 @@ SetJavaVMArgs()
else {
args_success = args.GetArgsStringV2Raw(&value,&error_msg);
if(!value.IsEmpty()) {
- strbuffer.sprintf("%s = \"%s\"",ATTR_JOB_JAVA_VM_ARGS2,
+ strbuffer.formatstr("%s = \"%s\"",ATTR_JOB_JAVA_VM_ARGS2,
value.EscapeChars("\"",'\\').Value());
InsertJobExpr (strbuffer);
}
@@ -3402,40 +3402,40 @@ SetStdFile( int which_file )
switch( which_file )
{
case 0:
- strbuffer.sprintf( "%s = \"%s\"", ATTR_JOB_INPUT, macro_value);
+ strbuffer.formatstr( "%s = \"%s\"", ATTR_JOB_INPUT, macro_value);
InsertJobExpr (strbuffer);
if ( transfer_it ) {
check_open( macro_value, O_RDONLY );
- strbuffer.sprintf( "%s = %s", ATTR_STREAM_INPUT, stream_it ? "TRUE" : "FALSE" );
+ strbuffer.formatstr( "%s = %s", ATTR_STREAM_INPUT, stream_it ? "TRUE" : "FALSE" );
InsertJobExpr( strbuffer.Value() );
} else {
- strbuffer.sprintf( "%s = FALSE", ATTR_TRANSFER_INPUT );
+ strbuffer.formatstr( "%s = FALSE", ATTR_TRANSFER_INPUT );
InsertJobExpr( strbuffer.Value() );
}
break;
case 1:
- strbuffer.sprintf( "%s = \"%s\"", ATTR_JOB_OUTPUT, macro_value);
+ strbuffer.formatstr( "%s = \"%s\"", ATTR_JOB_OUTPUT, macro_value);
InsertJobExpr (strbuffer);
if ( transfer_it ) {
check_open( macro_value, O_WRONLY|O_CREAT|O_TRUNC );
- strbuffer.sprintf( "%s = %s", ATTR_STREAM_OUTPUT, stream_it ? "TRUE" : "FALSE" );
+ strbuffer.formatstr( "%s = %s", ATTR_STREAM_OUTPUT, stream_it ? "TRUE" : "FALSE" );
InsertJobExpr( strbuffer.Value() );
stream_stdout_toggle = stream_it;
} else {
- strbuffer.sprintf( "%s = FALSE", ATTR_TRANSFER_OUTPUT );
+ strbuffer.formatstr( "%s = FALSE", ATTR_TRANSFER_OUTPUT );
InsertJobExpr( strbuffer.Value() );
}
break;
case 2:
- strbuffer.sprintf( "%s = \"%s\"", ATTR_JOB_ERROR, macro_value);
+ strbuffer.formatstr( "%s = \"%s\"", ATTR_JOB_ERROR, macro_value);
InsertJobExpr (strbuffer);
if ( transfer_it ) {
check_open( macro_value, O_WRONLY|O_CREAT|O_TRUNC );
- strbuffer.sprintf( "%s = %s", ATTR_STREAM_ERROR, stream_it ? "TRUE" : "FALSE" );
+ strbuffer.formatstr( "%s = %s", ATTR_STREAM_ERROR, stream_it ? "TRUE" : "FALSE" );
InsertJobExpr( strbuffer.Value() );
stream_stderr_toggle = stream_it;
} else {
- strbuffer.sprintf( "%s = FALSE", ATTR_TRANSFER_ERROR );
+ strbuffer.formatstr( "%s = FALSE", ATTR_TRANSFER_ERROR );
InsertJobExpr( strbuffer.Value() );
}
break;
@@ -3459,34 +3459,34 @@ SetJobStatus()
DoCleanup(0,0,NULL);
exit( 1 );
}
- buffer.sprintf( "%s = %d", ATTR_JOB_STATUS, HELD);
+ buffer.formatstr( "%s = %d", ATTR_JOB_STATUS, HELD);
InsertJobExpr (buffer, false);
- buffer.sprintf( "%s=\"submitted on hold at user's request\"",
+ buffer.formatstr( "%s=\"submitted on hold at user's request\"",
ATTR_HOLD_REASON );
InsertJobExpr( buffer );
- buffer.sprintf( "%s = %d", ATTR_HOLD_REASON_CODE,
+ buffer.formatstr( "%s = %d", ATTR_HOLD_REASON_CODE,
CONDOR_HOLD_CODE_SubmittedOnHold );
InsertJobExpr( buffer );
} else
if ( Remote ) {
- buffer.sprintf( "%s = %d", ATTR_JOB_STATUS, HELD);
+ buffer.formatstr( "%s = %d", ATTR_JOB_STATUS, HELD);
InsertJobExpr (buffer, false);
- buffer.sprintf( "%s=\"Spooling input data files\"",
+ buffer.formatstr( "%s=\"Spooling input data files\"",
ATTR_HOLD_REASON );
InsertJobExpr( buffer );
- buffer.sprintf( "%s = %d", ATTR_HOLD_REASON_CODE,
+ buffer.formatstr( "%s = %d", ATTR_HOLD_REASON_CODE,
CONDOR_HOLD_CODE_SpoolingInput );
InsertJobExpr( buffer );
} else {
- buffer.sprintf( "%s = %d", ATTR_JOB_STATUS, IDLE);
+ buffer.formatstr( "%s = %d", ATTR_JOB_STATUS, IDLE);
InsertJobExpr (buffer, false);
}
- buffer.sprintf( "%s = %d", ATTR_ENTERED_CURRENT_STATUS,
+ buffer.formatstr( "%s = %d", ATTR_ENTERED_CURRENT_STATUS,
(int)time(0) );
InsertJobExpr( buffer );
@@ -3507,21 +3507,21 @@ SetPriority()
prioval = atoi (prio);
free(prio);
}
- buffer.sprintf( "%s = %d", ATTR_JOB_PRIO, prioval);
+ buffer.formatstr( "%s = %d", ATTR_JOB_PRIO, prioval);
InsertJobExpr (buffer);
// also check if the job is "dirt user" priority (i.e., nice_user==True)
char *nice_user = condor_param( NiceUser, ATTR_NICE_USER );
if( nice_user && (*nice_user == 'T' || *nice_user == 't') )
{
- buffer.sprintf( "%s = TRUE", ATTR_NICE_USER );
+ buffer.formatstr( "%s = TRUE", ATTR_NICE_USER );
InsertJobExpr( buffer );
free(nice_user);
nice_user_setting = true;
}
else
{
- buffer.sprintf( "%s = FALSE", ATTR_NICE_USER );
+ buffer.formatstr( "%s = FALSE", ATTR_NICE_USER );
InsertJobExpr( buffer );
nice_user_setting = false;
}
@@ -3546,7 +3546,7 @@ SetMaxJobRetirementTime()
}
if(value) {
MyString expr;
- expr.sprintf("%s = %s",ATTR_MAX_JOB_RETIREMENT_TIME, value);
+ expr.formatstr("%s = %s",ATTR_MAX_JOB_RETIREMENT_TIME, value);
InsertJobExpr(expr);
}
}
@@ -3560,12 +3560,12 @@ SetPeriodicHoldCheck(void)
if (phc == NULL)
{
/* user didn't have one, so add one */
- buffer.sprintf( "%s = FALSE", ATTR_PERIODIC_HOLD_CHECK );
+ buffer.formatstr( "%s = FALSE", ATTR_PERIODIC_HOLD_CHECK );
}
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_PERIODIC_HOLD_CHECK, phc );
+ buffer.formatstr( "%s = %s", ATTR_PERIODIC_HOLD_CHECK, phc );
free(phc);
}
@@ -3573,14 +3573,14 @@ SetPeriodicHoldCheck(void)
phc = condor_param(PeriodicHoldReason, ATTR_PERIODIC_HOLD_REASON);
if( phc ) {
- buffer.sprintf( "%s = %s", ATTR_PERIODIC_HOLD_REASON, phc );
+ buffer.formatstr( "%s = %s", ATTR_PERIODIC_HOLD_REASON, phc );
InsertJobExpr( buffer );
free(phc);
}
phc = condor_param(PeriodicHoldSubCode, ATTR_PERIODIC_HOLD_SUBCODE);
if( phc ) {
- buffer.sprintf( "%s = %s", ATTR_PERIODIC_HOLD_SUBCODE, phc );
+ buffer.formatstr( "%s = %s", ATTR_PERIODIC_HOLD_SUBCODE, phc );
InsertJobExpr( buffer );
free(phc);
}
@@ -3590,12 +3590,12 @@ SetPeriodicHoldCheck(void)
if (phc == NULL)
{
/* user didn't have one, so add one */
- buffer.sprintf( "%s = FALSE", ATTR_PERIODIC_RELEASE_CHECK );
+ buffer.formatstr( "%s = FALSE", ATTR_PERIODIC_RELEASE_CHECK );
}
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_PERIODIC_RELEASE_CHECK, phc );
+ buffer.formatstr( "%s = %s", ATTR_PERIODIC_RELEASE_CHECK, phc );
free(phc);
}
@@ -3611,25 +3611,25 @@ SetPeriodicRemoveCheck(void)
if (prc == NULL)
{
/* user didn't have one, so add one */
- buffer.sprintf( "%s = FALSE", ATTR_PERIODIC_REMOVE_CHECK );
+ buffer.formatstr( "%s = FALSE", ATTR_PERIODIC_REMOVE_CHECK );
}
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_PERIODIC_REMOVE_CHECK, prc );
+ buffer.formatstr( "%s = %s", ATTR_PERIODIC_REMOVE_CHECK, prc );
free(prc);
}
prc = condor_param(OnExitHoldReason, ATTR_ON_EXIT_HOLD_REASON);
if( prc ) {
- buffer.sprintf( "%s = %s", ATTR_ON_EXIT_HOLD_REASON, prc );
+ buffer.formatstr( "%s = %s", ATTR_ON_EXIT_HOLD_REASON, prc );
InsertJobExpr( buffer );
free(prc);
}
prc = condor_param(OnExitHoldSubCode, ATTR_ON_EXIT_HOLD_SUBCODE);
if( prc ) {
- buffer.sprintf( "%s = %s", ATTR_ON_EXIT_HOLD_SUBCODE, prc );
+ buffer.formatstr( "%s = %s", ATTR_ON_EXIT_HOLD_SUBCODE, prc );
InsertJobExpr( buffer );
free(prc);
}
@@ -3646,12 +3646,12 @@ SetExitHoldCheck(void)
if (ehc == NULL)
{
/* user didn't have one, so add one */
- buffer.sprintf( "%s = FALSE", ATTR_ON_EXIT_HOLD_CHECK );
+ buffer.formatstr( "%s = FALSE", ATTR_ON_EXIT_HOLD_CHECK );
}
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_ON_EXIT_HOLD_CHECK, ehc );
+ buffer.formatstr( "%s = %s", ATTR_ON_EXIT_HOLD_CHECK, ehc );
free(ehc);
}
@@ -3668,12 +3668,12 @@ SetLeaveInQueue()
{
/* user didn't have one, so add one */
if ( !Remote ) {
- buffer.sprintf( "%s = FALSE", ATTR_JOB_LEAVE_IN_QUEUE );
+ buffer.formatstr( "%s = FALSE", ATTR_JOB_LEAVE_IN_QUEUE );
} else {
/* if remote spooling, leave in the queue after the job completes
for up to 10 days, so user can grab the output.
*/
- buffer.sprintf(
+ buffer.formatstr(
"%s = %s == %d && (%s =?= UNDEFINED || %s == 0 || ((CurrentTime - %s) < %d))",
ATTR_JOB_LEAVE_IN_QUEUE,
ATTR_JOB_STATUS,
@@ -3688,7 +3688,7 @@ SetLeaveInQueue()
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_JOB_LEAVE_IN_QUEUE, erc );
+ buffer.formatstr( "%s = %s", ATTR_JOB_LEAVE_IN_QUEUE, erc );
free(erc);
}
@@ -3705,12 +3705,12 @@ SetExitRemoveCheck(void)
if (erc == NULL)
{
/* user didn't have one, so add one */
- buffer.sprintf( "%s = TRUE", ATTR_ON_EXIT_REMOVE_CHECK );
+ buffer.formatstr( "%s = TRUE", ATTR_ON_EXIT_REMOVE_CHECK );
}
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_ON_EXIT_REMOVE_CHECK, erc );
+ buffer.formatstr( "%s = %s", ATTR_ON_EXIT_REMOVE_CHECK, erc );
free(erc);
}
@@ -3731,7 +3731,7 @@ SetNoopJob(void)
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_JOB_NOOP, noop );
+ buffer.formatstr( "%s = %s", ATTR_JOB_NOOP, noop );
free(noop);
}
@@ -3752,7 +3752,7 @@ SetNoopJobExitSignal(void)
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_JOB_NOOP_EXIT_SIGNAL, noop );
+ buffer.formatstr( "%s = %s", ATTR_JOB_NOOP_EXIT_SIGNAL, noop );
free(noop);
}
@@ -3773,7 +3773,7 @@ SetNoopJobExitCode(void)
else
{
/* user had a value for it, leave it alone */
- buffer.sprintf( "%s = %s", ATTR_JOB_NOOP_EXIT_CODE, noop );
+ buffer.formatstr( "%s = %s", ATTR_JOB_NOOP_EXIT_CODE, noop );
free(noop);
}
@@ -3787,10 +3787,10 @@ SetWantRemoteIO(void)
MyString buffer;
if (how == NULL) {
- buffer.sprintf( "%s = TRUE",
+ buffer.formatstr( "%s = TRUE",
ATTR_WANT_REMOTE_IO);
} else {
- buffer.sprintf( "%s = %s", ATTR_WANT_REMOTE_IO,
+ buffer.formatstr( "%s = %s", ATTR_WANT_REMOTE_IO,
isTrue(how)?"TRUE":"FALSE" );
}
@@ -3827,7 +3827,7 @@ SetNotification()
exit( 1 );
}
- buffer.sprintf( "%s = %d", ATTR_JOB_NOTIFICATION, notification);
+ buffer.formatstr( "%s = %d", ATTR_JOB_NOTIFICATION, notification);
InsertJobExpr (buffer);
if ( how ) {
@@ -3868,7 +3868,7 @@ SetNotifyUser()
did_warning = true;
}
- buffer.sprintf( "%s = \"%s\"", ATTR_NOTIFY_USER, who);
+ buffer.formatstr( "%s = \"%s\"", ATTR_NOTIFY_USER, who);
InsertJobExpr (buffer);
free(who);
}
@@ -3881,7 +3881,7 @@ SetWantGracefulRemoval()
MyString buffer;
if( how ) {
- buffer.sprintf( "%s = %s", ATTR_WANT_GRACEFUL_REMOVAL, how );
+ buffer.formatstr( "%s = %s", ATTR_WANT_GRACEFUL_REMOVAL, how );
InsertJobExpr (buffer);
free( how );
}
@@ -3894,7 +3894,7 @@ SetJobMaxVacateTime()
MyString buffer;
if( expr ) {
- buffer.sprintf( "%s = %s", ATTR_JOB_MAX_VACATE_TIME, expr );
+ buffer.formatstr( "%s = %s", ATTR_JOB_MAX_VACATE_TIME, expr );
InsertJobExpr (buffer);
free( expr );
}
@@ -3913,7 +3913,7 @@ SetEmailAttributes()
MyString buffer;
tmp = attr_list.print_to_string();
- buffer.sprintf( "%s = \"%s\"", ATTR_EMAIL_ATTRIBUTES, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EMAIL_ATTRIBUTES, tmp );
InsertJobExpr( buffer );
free( tmp );
}
@@ -3960,7 +3960,7 @@ SetCronTab()
// Go ahead and stuff it in the job ad now
// The parameters must be wrapped in quotation marks
//
- buffer.sprintf( "%s = \"%s\"", CronTab::attributes[ctr], param );
+ buffer.formatstr( "%s = \"%s\"", CronTab::attributes[ctr], param );
InsertJobExpr (buffer);
free( param );
NeedsJobDeferral = true;
@@ -3992,7 +3992,7 @@ SetMatchListLen()
ATTR_LAST_MATCH_LIST_LENGTH );
if( tmp ) {
len = atoi(tmp);
- buffer.sprintf( "%s = %d", ATTR_LAST_MATCH_LIST_LENGTH, len );
+ buffer.formatstr( "%s = %d", ATTR_LAST_MATCH_LIST_LENGTH, len );
InsertJobExpr( buffer );
free( tmp );
}
@@ -4004,7 +4004,7 @@ SetDAGNodeName()
char* name = condor_param( ATTR_DAG_NODE_NAME_ALT, ATTR_DAG_NODE_NAME );
MyString buffer;
if( name ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DAG_NODE_NAME, name );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DAG_NODE_NAME, name );
InsertJobExpr( buffer );
free( name );
}
@@ -4016,7 +4016,7 @@ SetDAGManJobId()
char* id = condor_param( DAGManJobId, ATTR_DAGMAN_JOB_ID );
MyString buffer;
if( id ) {
- (void) buffer.sprintf( "%s = \"%s\"", ATTR_DAGMAN_JOB_ID, id );
+ (void) buffer.formatstr( "%s = \"%s\"", ATTR_DAGMAN_JOB_ID, id );
InsertJobExpr( buffer );
free( id );
}
@@ -4046,7 +4046,7 @@ SetStackSize()
StackSizeVal = condor_param(StackSize,ATTR_STACK_SIZE);
MyString buffer;
if( StackSizeVal ) {
- (void) buffer.sprintf( "%s = %s", ATTR_STACK_SIZE, StackSizeVal);
+ (void) buffer.formatstr( "%s = %s", ATTR_STACK_SIZE, StackSizeVal);
InsertJobExpr(buffer);
}
}
@@ -4057,7 +4057,7 @@ SetRemoteInitialDir()
char *who = condor_param( RemoteInitialDir, ATTR_JOB_REMOTE_IWD );
MyString buffer;
if (who) {
- buffer.sprintf( "%s = \"%s\"", ATTR_JOB_REMOTE_IWD, who);
+ buffer.formatstr( "%s = \"%s\"", ATTR_JOB_REMOTE_IWD, who);
InsertJobExpr (buffer);
free(who);
}
@@ -4086,7 +4086,7 @@ SetOutputDestination()
char *od = condor_param( OutputDestination, ATTR_OUTPUT_DESTINATION );
MyString buffer;
if (od) {
- buffer.sprintf( "%s = \"%s\"", ATTR_OUTPUT_DESTINATION, od);
+ buffer.formatstr( "%s = \"%s\"", ATTR_OUTPUT_DESTINATION, od);
InsertJobExpr (buffer);
free(od);
}
@@ -4140,12 +4140,12 @@ SetArguments()
}
if(MyCondorVersionRequiresV1) {
args_success = arglist.GetArgsStringV1Raw(&value,&error_msg);
- strbuffer.sprintf("%s = \"%s\"",ATTR_JOB_ARGUMENTS1,
+ strbuffer.formatstr("%s = \"%s\"",ATTR_JOB_ARGUMENTS1,
value.EscapeChars("\"",'\\').Value());
}
else {
args_success = arglist.GetArgsStringV2Raw(&value,&error_msg);
- strbuffer.sprintf("%s = \"%s\"",ATTR_JOB_ARGUMENTS2,
+ strbuffer.formatstr("%s = \"%s\"",ATTR_JOB_ARGUMENTS2,
value.EscapeChars("\"",'\\').Value());
}
@@ -4189,7 +4189,7 @@ SetJobDeferral() {
// make certain the input is valid
non_negative_int_fail(DeferralTime, temp);
- buffer.sprintf( "%s = %s", ATTR_DEFERRAL_TIME, temp );
+ buffer.formatstr( "%s = %s", ATTR_DEFERRAL_TIME, temp );
InsertJobExpr (buffer);
free( temp );
NeedsJobDeferral = true;
@@ -4232,13 +4232,13 @@ SetJobDeferral() {
// make certain the input is valid
non_negative_int_fail(DeferralWindow, temp);
- buffer.sprintf( "%s = %s", ATTR_DEFERRAL_WINDOW, temp );
+ buffer.formatstr( "%s = %s", ATTR_DEFERRAL_WINDOW, temp );
free( temp );
//
// Otherwise, use the default value
//
} else {
- buffer.sprintf( "%s = %d",
+ buffer.formatstr( "%s = %d",
ATTR_DEFERRAL_WINDOW, JOB_DEFERRAL_WINDOW_DEFAULT );
}
InsertJobExpr (buffer);
@@ -4270,13 +4270,13 @@ SetJobDeferral() {
// make certain the input is valid
non_negative_int_fail(DeferralPrepTime, temp);
- buffer.sprintf( "%s = %s", ATTR_DEFERRAL_PREP_TIME, temp );
+ buffer.formatstr( "%s = %s", ATTR_DEFERRAL_PREP_TIME, temp );
free( temp );
//
// Otherwise, use the default value
//
} else {
- buffer.sprintf( "%s = %d",
+ buffer.formatstr( "%s = %d",
ATTR_DEFERRAL_PREP_TIME, JOB_DEFERRAL_PREP_TIME_DEFAULT );
}
InsertJobExpr (buffer);
@@ -4289,10 +4289,10 @@ SetJobDeferral() {
//
temp = param( "SCHEDD_INTERVAL" );
if ( temp != NULL ) {
- buffer.sprintf( "%s = %s", ATTR_SCHEDD_INTERVAL, temp );
+ buffer.formatstr( "%s = %s", ATTR_SCHEDD_INTERVAL, temp );
free( temp );
} else {
- buffer.sprintf( "%s = %d", ATTR_SCHEDD_INTERVAL,
+ buffer.formatstr( "%s = %d", ATTR_SCHEDD_INTERVAL,
SCHEDD_INTERVAL_DEFAULT );
}
InsertJobExpr (buffer);
@@ -4442,7 +4442,7 @@ SetEnvironment()
MyString newenv_raw;
env_success = envobject.getDelimitedStringV1Raw(&newenv_raw,&error_msg);
- newenv.sprintf("%s = \"%s\"",
+ newenv.formatstr("%s = \"%s\"",
ATTR_JOB_ENVIRONMENT1,
newenv_raw.EscapeChars("\"",'\\').Value());
InsertJobExpr(newenv);
@@ -4450,7 +4450,7 @@ SetEnvironment()
// Record in the JobAd the V1 delimiter that is being used.
// This way remote submits across platforms have a prayer.
MyString delim_assign;
- delim_assign.sprintf("%s = \"%c\"",
+ delim_assign.formatstr("%s = \"%c\"",
ATTR_JOB_ENVIRONMENT1_DELIM,
envobject.GetEnvV1Delimiter());
InsertJobExpr(delim_assign);
@@ -4461,7 +4461,7 @@ SetEnvironment()
MyString newenv_raw;
env_success = envobject.getDelimitedStringV2Raw(&newenv_raw,&error_msg);
- newenv.sprintf("%s = \"%s\"",
+ newenv.formatstr("%s = \"%s\"",
ATTR_JOB_ENVIRONMENT2,
newenv_raw.EscapeChars("\"",'\\').Value());
InsertJobExpr(newenv);
@@ -4518,7 +4518,7 @@ SetRootDir()
{
MyString buffer;
ComputeRootDir();
- buffer.sprintf( "%s = \"%s\"", ATTR_JOB_ROOT_DIR, JobRootdir.Value());
+ buffer.formatstr( "%s = \"%s\"", ATTR_JOB_ROOT_DIR, JobRootdir.Value());
InsertJobExpr (buffer);
}
#endif
@@ -4540,7 +4540,7 @@ SetRequirements()
}
check_requirements( JobRequirements.Value(), tmp );
- buffer.sprintf( "%s = %s", ATTR_REQUIREMENTS, tmp.Value());
+ buffer.formatstr( "%s = %s", ATTR_REQUIREMENTS, tmp.Value());
JobRequirements = tmp;
InsertJobExpr (buffer);
@@ -4548,7 +4548,7 @@ SetRequirements()
char* fs_domain = NULL;
if( (should_transfer == STF_NO || should_transfer == STF_IF_NEEDED)
&& ! job->LookupString(ATTR_FILE_SYSTEM_DOMAIN, &fs_domain) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_FILE_SYSTEM_DOMAIN,
+ buffer.formatstr( "%s = \"%s\"", ATTR_FILE_SYSTEM_DOMAIN,
My_fs_domain );
InsertJobExpr( buffer );
}
@@ -4583,19 +4583,19 @@ SetTDP( void )
HasTDP = true;
path = tdp_cmd;
check_and_universalize_path( path );
- buf.sprintf( "%s = \"%s\"", ATTR_TOOL_DAEMON_CMD, path.Value() );
+ buf.formatstr( "%s = \"%s\"", ATTR_TOOL_DAEMON_CMD, path.Value() );
InsertJobExpr( buf.Value() );
}
if( tdp_input ) {
path = tdp_input;
check_and_universalize_path( path );
- buf.sprintf( "%s = \"%s\"", ATTR_TOOL_DAEMON_INPUT, path.Value() );
+ buf.formatstr( "%s = \"%s\"", ATTR_TOOL_DAEMON_INPUT, path.Value() );
InsertJobExpr( buf.Value() );
}
if( tdp_output ) {
path = tdp_output;
check_and_universalize_path( path );
- buf.sprintf( "%s = \"%s\"", ATTR_TOOL_DAEMON_OUTPUT, path.Value() );
+ buf.formatstr( "%s = \"%s\"", ATTR_TOOL_DAEMON_OUTPUT, path.Value() );
InsertJobExpr( buf.Value() );
free( tdp_output );
tdp_output = NULL;
@@ -4603,7 +4603,7 @@ SetTDP( void )
if( tdp_error ) {
path = tdp_error;
check_and_universalize_path( path );
- buf.sprintf( "%s = \"%s\"", ATTR_TOOL_DAEMON_ERROR, path.Value() );
+ buf.formatstr( "%s = \"%s\"", ATTR_TOOL_DAEMON_ERROR, path.Value() );
InsertJobExpr( buf.Value() );
free( tdp_error );
tdp_error = NULL;
@@ -4659,7 +4659,7 @@ SetTDP( void )
if(MyCondorVersionRequiresV1) {
args_success = args.GetArgsStringV1Raw(&args_value,&error_msg);
if(!args_value.IsEmpty()) {
- buf.sprintf("%s = \"%s\"",ATTR_TOOL_DAEMON_ARGS1,
+ buf.formatstr("%s = \"%s\"",ATTR_TOOL_DAEMON_ARGS1,
args_value.EscapeChars("\"",'\\').Value());
InsertJobExpr( buf );
}
@@ -4667,7 +4667,7 @@ SetTDP( void )
else if(args.Count()) {
args_success = args.GetArgsStringV2Raw(&args_value,&error_msg);
if(!args_value.IsEmpty()) {
- buf.sprintf("%s = \"%s\"",ATTR_TOOL_DAEMON_ARGS2,
+ buf.formatstr("%s = \"%s\"",ATTR_TOOL_DAEMON_ARGS2,
args_value.EscapeChars("\"",'\\').Value());
InsertJobExpr( buf );
}
@@ -4681,7 +4681,7 @@ SetTDP( void )
}
if( suspend_at_exec ) {
- buf.sprintf( "%s = %s", ATTR_SUSPEND_JOB_AT_EXEC,
+ buf.formatstr( "%s = %s", ATTR_SUSPEND_JOB_AT_EXEC,
isTrue(suspend_at_exec) ? "TRUE" : "FALSE" );
InsertJobExpr( buf.Value() );
free( suspend_at_exec );
@@ -4708,7 +4708,7 @@ SetRunAsOwner()
}
MyString buffer;
- buffer.sprintf( "%s = %s", ATTR_JOB_RUNAS_OWNER, bRunAsOwner ? "True" : "False" );
+ buffer.formatstr( "%s = %s", ATTR_JOB_RUNAS_OWNER, bRunAsOwner ? "True" : "False" );
InsertJobExpr (buffer);
#if defined(WIN32)
@@ -4741,7 +4741,7 @@ SetLoadProfile()
}
MyString buffer;
- buffer.sprintf ( "%s = True", ATTR_JOB_LOAD_PROFILE );
+ buffer.formatstr ( "%s = True", ATTR_JOB_LOAD_PROFILE );
InsertJobExpr ( buffer );
/* If we've been called it means that SetRunAsOwner() has already
@@ -4835,10 +4835,10 @@ SetRank()
}
if( rank.Length() == 0 ) {
- buffer.sprintf( "%s = 0.0", ATTR_RANK );
+ buffer.formatstr( "%s = 0.0", ATTR_RANK );
InsertJobExpr( buffer );
} else {
- buffer.sprintf( "%s = %s", ATTR_RANK, rank.Value() );
+ buffer.formatstr( "%s = %s", ATTR_RANK, rank.Value() );
InsertJobExpr( buffer );
}
@@ -4896,7 +4896,7 @@ ComputeIWD()
}
else {
condor_getcwd( cwd );
- iwd.sprintf( "%s%c%s", cwd.Value(), DIR_DELIM_CHAR, shortname );
+ iwd.formatstr( "%s%c%s", cwd.Value(), DIR_DELIM_CHAR, shortname );
}
}
else {
@@ -4918,7 +4918,7 @@ SetIWD()
{
MyString buffer;
ComputeIWD();
- buffer.sprintf( "%s = \"%s\"", ATTR_JOB_IWD, JobIwd.Value());
+ buffer.formatstr( "%s = \"%s\"", ATTR_JOB_IWD, JobIwd.Value());
InsertJobExpr (buffer);
}
@@ -4930,7 +4930,7 @@ check_iwd( char const *iwd )
#if defined(WIN32)
pathname = iwd;
#else
- pathname.sprintf( "%s/%s", JobRootdir.Value(), iwd );
+ pathname.formatstr( "%s/%s", JobRootdir.Value(), iwd );
#endif
compress( pathname );
@@ -5020,10 +5020,10 @@ SetUserLogXML()
if (use_xml) {
if ('T' == *use_xml || 't' == *use_xml) {
UseXMLInLog = true;
- buffer.sprintf( "%s = TRUE", ATTR_ULOG_USE_XML);
+ buffer.formatstr( "%s = TRUE", ATTR_ULOG_USE_XML);
InsertJobExpr( buffer );
} else {
- buffer.sprintf( "%s = FALSE", ATTR_ULOG_USE_XML);
+ buffer.formatstr( "%s = FALSE", ATTR_ULOG_USE_XML);
}
free(use_xml);
}
@@ -5056,7 +5056,7 @@ SetCoreSize()
free(size);
}
- buffer.sprintf( "%s = %ld", ATTR_CORE_SIZE, coresize);
+ buffer.formatstr( "%s = %ld", ATTR_CORE_SIZE, coresize);
InsertJobExpr(buffer);
}
@@ -5139,7 +5139,7 @@ SetForcedAttributes()
" Ignoring.\n", value.Value() );
continue;
}
- buffer.sprintf( "%s = %s", name.value(), exValue );
+ buffer.formatstr( "%s = %s", name.value(), exValue );
// Call InserJobExpr with checkcluster set to false.
// This will result in forced attributes always going
// into the proc ad, not the cluster ad. This allows
@@ -5165,17 +5165,17 @@ SetGridParams()
if ( tmp ) {
// TODO validate number of fields in grid_resource?
- buffer.sprintf( "%s = \"%s\"", ATTR_GRID_RESOURCE, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_GRID_RESOURCE, tmp );
InsertJobExpr( buffer );
if ( strstr(tmp,"$$") ) {
// We need to perform matchmaking on the job in order
// to fill GridResource.
- buffer.sprintf("%s = FALSE", ATTR_JOB_MATCHED);
+ buffer.formatstr("%s = FALSE", ATTR_JOB_MATCHED);
InsertJobExpr (buffer);
- buffer.sprintf("%s = 0", ATTR_CURRENT_HOSTS);
+ buffer.formatstr("%s = 0", ATTR_CURRENT_HOSTS);
InsertJobExpr (buffer);
- buffer.sprintf("%s = 1", ATTR_MAX_HOSTS);
+ buffer.formatstr("%s = 1", ATTR_MAX_HOSTS);
InsertJobExpr (buffer);
}
@@ -5203,11 +5203,11 @@ SetGridParams()
strcasecmp (JobGridType, "nordugrid") == MATCH ) {
if( (tmp = condor_param(GlobusResubmit,ATTR_GLOBUS_RESUBMIT_CHECK)) ) {
- buffer.sprintf( "%s = %s", ATTR_GLOBUS_RESUBMIT_CHECK, tmp );
+ buffer.formatstr( "%s = %s", ATTR_GLOBUS_RESUBMIT_CHECK, tmp );
free(tmp);
InsertJobExpr (buffer);
} else {
- buffer.sprintf( "%s = FALSE", ATTR_GLOBUS_RESUBMIT_CHECK);
+ buffer.formatstr( "%s = FALSE", ATTR_GLOBUS_RESUBMIT_CHECK);
InsertJobExpr (buffer);
}
}
@@ -5215,7 +5215,7 @@ SetGridParams()
if ( (tmp = condor_param(GridShell, ATTR_USE_GRID_SHELL)) ) {
if( tmp[0] == 't' || tmp[0] == 'T' ) {
- buffer.sprintf( "%s = TRUE", ATTR_USE_GRID_SHELL );
+ buffer.formatstr( "%s = TRUE", ATTR_USE_GRID_SHELL );
InsertJobExpr( buffer );
}
free(tmp);
@@ -5225,31 +5225,31 @@ SetGridParams()
strcasecmp (JobGridType, "gt2") == MATCH ||
strcasecmp (JobGridType, "gt5") == MATCH ) {
- buffer.sprintf( "%s = %d", ATTR_GLOBUS_STATUS,
+ buffer.formatstr( "%s = %d", ATTR_GLOBUS_STATUS,
GLOBUS_GRAM_PROTOCOL_JOB_STATE_UNSUBMITTED );
InsertJobExpr (buffer);
- buffer.sprintf( "%s = 0", ATTR_NUM_GLOBUS_SUBMITS );
+ buffer.formatstr( "%s = 0", ATTR_NUM_GLOBUS_SUBMITS );
InsertJobExpr (buffer);
}
- buffer.sprintf( "%s = False", ATTR_WANT_CLAIMING );
+ buffer.formatstr( "%s = False", ATTR_WANT_CLAIMING );
InsertJobExpr(buffer);
if( (tmp = condor_param(GlobusRematch,ATTR_REMATCH_CHECK)) ) {
- buffer.sprintf( "%s = %s", ATTR_REMATCH_CHECK, tmp );
+ buffer.formatstr( "%s = %s", ATTR_REMATCH_CHECK, tmp );
free(tmp);
InsertJobExpr (buffer);
}
if( (tmp = condor_param(GlobusRSL, ATTR_GLOBUS_RSL)) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_GLOBUS_RSL, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_GLOBUS_RSL, tmp );
free( tmp );
InsertJobExpr ( buffer );
}
if( (tmp = condor_param(NordugridRSL, ATTR_NORDUGRID_RSL)) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_NORDUGRID_RSL, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_NORDUGRID_RSL, tmp );
free( tmp );
InsertJobExpr ( buffer );
}
@@ -5265,7 +5265,7 @@ SetGridParams()
}
if ( (tmp = condor_param( KeystoreFile, ATTR_KEYSTORE_FILE )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_KEYSTORE_FILE, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_KEYSTORE_FILE, tmp );
InsertJobExpr( buffer );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "unicore" ) == 0 ) {
@@ -5276,7 +5276,7 @@ SetGridParams()
}
if ( (tmp = condor_param( KeystoreAlias, ATTR_KEYSTORE_ALIAS )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_KEYSTORE_ALIAS, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_KEYSTORE_ALIAS, tmp );
InsertJobExpr( buffer );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "unicore" ) == 0 ) {
@@ -5288,7 +5288,7 @@ SetGridParams()
if ( (tmp = condor_param( KeystorePassphraseFile,
ATTR_KEYSTORE_PASSPHRASE_FILE )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_KEYSTORE_PASSPHRASE_FILE, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_KEYSTORE_PASSPHRASE_FILE, tmp );
InsertJobExpr( buffer );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "unicore" ) == 0 ) {
@@ -5317,7 +5317,7 @@ SetGridParams()
exit(1);
}
}
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_ACCESS_KEY_ID, full_path(tmp) );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_ACCESS_KEY_ID, full_path(tmp) );
InsertJobExpr( buffer.Value() );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "ec2" ) == 0 ) {
@@ -5342,7 +5342,7 @@ SetGridParams()
exit(1);
}
}
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_SECRET_ACCESS_KEY, full_path(tmp) );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_SECRET_ACCESS_KEY, full_path(tmp) );
InsertJobExpr( buffer.Value() );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "ec2" ) == 0 ) {
@@ -5355,7 +5355,7 @@ SetGridParams()
// EC2KeyPair is not a necessary parameter
if( (tmp = condor_param( EC2KeyPair, ATTR_EC2_KEY_PAIR )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_KEY_PAIR, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_KEY_PAIR, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
bKeyPairPresent=true;
@@ -5370,7 +5370,7 @@ SetGridParams()
else
{
// for the relative path, the keypair output file will be written to the IWD
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_KEY_PAIR_FILE, full_path(tmp) );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_KEY_PAIR_FILE, full_path(tmp) );
free( tmp );
InsertJobExpr( buffer.Value() );
}
@@ -5378,13 +5378,13 @@ SetGridParams()
// EC2GroupName is not a necessary parameter
if( (tmp = condor_param( EC2SecurityGroups, ATTR_EC2_SECURITY_GROUPS )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_SECURITY_GROUPS, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_SECURITY_GROUPS, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
if ( (tmp = condor_param( EC2AmiID, ATTR_EC2_AMI_ID )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_AMI_ID, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_AMI_ID, tmp );
InsertJobExpr( buffer.Value() );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "ec2" ) == 0 ) {
@@ -5395,28 +5395,28 @@ SetGridParams()
// EC2InstanceType is not a necessary parameter
if( (tmp = condor_param( EC2InstanceType, ATTR_EC2_INSTANCE_TYPE )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_INSTANCE_TYPE, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_INSTANCE_TYPE, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
// EC2VpcSubnet is not a necessary parameter
if( (tmp = condor_param( EC2VpcSubnet, ATTR_EC2_VPC_SUBNET )) ) {
- buffer.sprintf( "%s = \"%s\"",ATTR_EC2_VPC_SUBNET , tmp );
+ buffer.formatstr( "%s = \"%s\"",ATTR_EC2_VPC_SUBNET , tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
// EC2VpcIP is not a necessary parameter
if( (tmp = condor_param( EC2VpcIP, ATTR_EC2_VPC_IP )) ) {
- buffer.sprintf( "%s = \"%s\"",ATTR_EC2_VPC_IP , tmp );
+ buffer.formatstr( "%s = \"%s\"",ATTR_EC2_VPC_IP , tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
// EC2ElasticIP is not a necessary parameter
if( (tmp = condor_param( EC2ElasticIP, ATTR_EC2_ELASTIC_IP )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_ELASTIC_IP, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_ELASTIC_IP, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
@@ -5424,7 +5424,7 @@ SetGridParams()
bool HasAvailabilityZone=false;
// EC2AvailabilityZone is not a necessary parameter
if( (tmp = condor_param( EC2AvailabilityZone, ATTR_EC2_AVAILABILITY_ZONE )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_AVAILABILITY_ZONE, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_AVAILABILITY_ZONE, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
HasAvailabilityZone=true;
@@ -5452,14 +5452,14 @@ SetGridParams()
exit(1);
}
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_EBS_VOLUMES, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_EBS_VOLUMES, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
// EC2UserData is not a necessary parameter
if( (tmp = condor_param( EC2UserData, ATTR_EC2_USER_DATA )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_USER_DATA, tmp);
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_USER_DATA, tmp);
free( tmp );
InsertJobExpr( buffer.Value() );
}
@@ -5475,7 +5475,7 @@ SetGridParams()
}
fclose(fp);
}
- buffer.sprintf( "%s = \"%s\"", ATTR_EC2_USER_DATA_FILE,
+ buffer.formatstr( "%s = \"%s\"", ATTR_EC2_USER_DATA_FILE,
full_path(tmp) );
free( tmp );
InsertJobExpr( buffer.Value() );
@@ -5530,7 +5530,7 @@ SetGridParams()
std::string tagCmd("ec2_tag_"); tagCmd.append(tagName);
char *value = NULL;
if ((value = condor_param(tagCmd.c_str(), tagAttr.c_str()))) {
- buffer.sprintf("%s = \"%s\"", tagAttr.c_str(), value);
+ buffer.formatstr("%s = \"%s\"", tagAttr.c_str(), value);
InsertJobExpr(buffer.Value());
free(value); value = NULL;
} else {
@@ -5547,14 +5547,14 @@ SetGridParams()
(strcasecmp( JobGridType, "ec2" ) == MATCH)) {
char *ename = condor_param(Executable, ATTR_JOB_CMD); // !NULL by now
tagNames.append("Name");
- buffer.sprintf("%sName = \"%s\"", ATTR_EC2_TAG_PREFIX, ename);
+ buffer.formatstr("%sName = \"%s\"", ATTR_EC2_TAG_PREFIX, ename);
InsertJobExpr(buffer);
free(ename); ename = NULL;
}
}
if ( !tagNames.isEmpty() ) {
- buffer.sprintf("%s = \"%s\"",
+ buffer.formatstr("%s = \"%s\"",
ATTR_EC2_TAG_NAMES, tagNames.print_to_delimed_string(","));
InsertJobExpr(buffer.Value());
}
@@ -5564,7 +5564,7 @@ SetGridParams()
// Deltacloud grid-type submit attributes
//
if ( (tmp = condor_param( DeltacloudUsername, ATTR_DELTACLOUD_USERNAME )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_USERNAME, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_USERNAME, tmp );
InsertJobExpr( buffer.Value() );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "deltacloud" ) == 0 ) {
@@ -5583,7 +5583,7 @@ SetGridParams()
}
fclose(fp);
}
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_PASSWORD_FILE, full_path(tmp) );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_PASSWORD_FILE, full_path(tmp) );
InsertJobExpr( buffer.Value() );
free( tmp );
} else if ( JobGridType && strcasecmp( JobGridType, "deltacloud" ) == 0 ) {
@@ -5594,14 +5594,14 @@ SetGridParams()
bool bInstanceName=false;
if( (tmp = condor_param( DeltacloudInstanceName, ATTR_DELTACLOUD_INSTANCE_NAME )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_INSTANCE_NAME, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_INSTANCE_NAME, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
bInstanceName = true;
}
if ( (tmp = condor_param( DeltacloudImageId, ATTR_DELTACLOUD_IMAGE_ID )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_IMAGE_ID, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_IMAGE_ID, tmp );
InsertJobExpr( buffer.Value() );
free( tmp );
} else if ( JobGridType && !bInstanceName && strcasecmp( JobGridType, "deltacloud" ) == 0 ) {
@@ -5611,43 +5611,43 @@ SetGridParams()
}
if( (tmp = condor_param( DeltacloudRealmId, ATTR_DELTACLOUD_REALM_ID )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_REALM_ID, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_REALM_ID, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
if( (tmp = condor_param( DeltacloudHardwareProfile, ATTR_DELTACLOUD_HARDWARE_PROFILE )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
if( (tmp = condor_param( DeltacloudHardwareProfileMemory, ATTR_DELTACLOUD_HARDWARE_PROFILE_MEMORY )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE_MEMORY, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE_MEMORY, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
if( (tmp = condor_param( DeltacloudHardwareProfileCpu, ATTR_DELTACLOUD_HARDWARE_PROFILE_CPU )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE_CPU, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE_CPU, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
if( (tmp = condor_param( DeltacloudHardwareProfileStorage, ATTR_DELTACLOUD_HARDWARE_PROFILE_STORAGE )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE_STORAGE, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_HARDWARE_PROFILE_STORAGE, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
if( (tmp = condor_param( DeltacloudKeyname, ATTR_DELTACLOUD_KEYNAME )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_KEYNAME, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_KEYNAME, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
if( (tmp = condor_param( DeltacloudUserData, ATTR_DELTACLOUD_USER_DATA )) ) {
- buffer.sprintf( "%s = \"%s\"", ATTR_DELTACLOUD_USER_DATA, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_DELTACLOUD_USER_DATA, tmp );
free( tmp );
InsertJobExpr( buffer.Value() );
}
@@ -5677,7 +5677,7 @@ SetGridParams()
resource.setChar( pos2, ' ' );
}
- buffer.sprintf( "%s = \"%s\"", ATTR_GRID_RESOURCE,
+ buffer.formatstr( "%s = \"%s\"", ATTR_GRID_RESOURCE,
resource.Value() );
InsertJobExpr( buffer );
}
@@ -5717,7 +5717,7 @@ SetGSICredentials()
if (proxy_file != NULL) {
if ( proxy_file[0] == '#' ) {
- buffer.sprintf( "%s=\"%s\"", ATTR_X509_USER_PROXY_SUBJECT,
+ buffer.formatstr( "%s=\"%s\"", ATTR_X509_USER_PROXY_SUBJECT,
&proxy_file[1]);
InsertJobExpr(buffer);
@@ -5797,7 +5797,7 @@ SetGSICredentials()
#endif
- (void) buffer.sprintf( "%s=\"%s\"", ATTR_X509_USER_PROXY,
+ (void) buffer.formatstr( "%s=\"%s\"", ATTR_X509_USER_PROXY,
full_path(proxy_file));
InsertJobExpr(buffer);
free( proxy_file );
@@ -5818,13 +5818,13 @@ SetGSICredentials()
//ckireyev: MyProxy-related crap
if ((tmp = condor_param (ATTR_MYPROXY_HOST_NAME))) {
- buffer.sprintf( "%s = \"%s\"", ATTR_MYPROXY_HOST_NAME, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_MYPROXY_HOST_NAME, tmp );
free( tmp );
InsertJobExpr ( buffer );
}
if ((tmp = condor_param (ATTR_MYPROXY_SERVER_DN))) {
- buffer.sprintf( "%s = \"%s\"", ATTR_MYPROXY_SERVER_DN, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_MYPROXY_SERVER_DN, tmp );
free( tmp );
InsertJobExpr ( buffer );
}
@@ -5836,24 +5836,24 @@ SetGSICredentials()
}
if ((tmp = condor_param (ATTR_MYPROXY_CRED_NAME))) {
- buffer.sprintf( "%s = \"%s\"", ATTR_MYPROXY_CRED_NAME, tmp );
+ buffer.formatstr( "%s = \"%s\"", ATTR_MYPROXY_CRED_NAME, tmp );
free( tmp );
InsertJobExpr ( buffer );
}
if (myproxy_password) {
- buffer.sprintf( "%s = %s", ATTR_MYPROXY_PASSWORD, myproxy_password);
+ buffer.formatstr( "%s = %s", ATTR_MYPROXY_PASSWORD, myproxy_password);
InsertJobExpr (buffer);
}
if ((tmp = condor_param (ATTR_MYPROXY_REFRESH_THRESHOLD))) {
- buffer.sprintf( "%s = %s", ATTR_MYPROXY_REFRESH_THRESHOLD, tmp );
+ buffer.formatstr( "%s = %s", ATTR_MYPROXY_REFRESH_THRESHOLD, tmp );
free( tmp );
InsertJobExpr ( buffer );
}
if ((tmp = condor_param (ATTR_MYPROXY_NEW_PROXY_LIFETIME))) {
- buffer.sprintf( "%s = %s", ATTR_MYPROXY_NEW_PROXY_LIFETIME, tmp );
+ buffer.formatstr( "%s = %s", ATTR_MYPROXY_NEW_PROXY_LIFETIME, tmp );
free( tmp );
InsertJobExpr ( buffer );
}
@@ -5922,14 +5922,14 @@ SetKillSig()
}
if ( sig_name ) {
- buffer.sprintf( "%s=\"%s\"", ATTR_KILL_SIG, sig_name );
+ buffer.formatstr( "%s=\"%s\"", ATTR_KILL_SIG, sig_name );
InsertJobExpr( buffer );
free( sig_name );
}
sig_name = findKillSigName( RmKillSig, ATTR_REMOVE_KILL_SIG );
if( sig_name ) {
- buffer.sprintf( "%s=\"%s\"", ATTR_REMOVE_KILL_SIG, sig_name );
+ buffer.formatstr( "%s=\"%s\"", ATTR_REMOVE_KILL_SIG, sig_name );
InsertJobExpr( buffer );
free( sig_name );
sig_name = NULL;
@@ -5937,7 +5937,7 @@ SetKillSig()
sig_name = findKillSigName( HoldKillSig, ATTR_HOLD_KILL_SIG );
if( sig_name ) {
- buffer.sprintf( "%s=\"%s\"", ATTR_HOLD_KILL_SIG, sig_name );
+ buffer.formatstr( "%s=\"%s\"", ATTR_HOLD_KILL_SIG, sig_name );
InsertJobExpr( buffer );
free( sig_name );
sig_name = NULL;
@@ -5945,7 +5945,7 @@ SetKillSig()
timeout = condor_param( KillSigTimeout, ATTR_KILL_SIG_TIMEOUT );
if( timeout ) {
- buffer.sprintf( "%s=%d", ATTR_KILL_SIG_TIMEOUT, atoi(timeout) );
+ buffer.formatstr( "%s=%d", ATTR_KILL_SIG_TIMEOUT, atoi(timeout) );
InsertJobExpr( buffer );
free( timeout );
sig_name = NULL;
@@ -6584,7 +6584,7 @@ check_requirements( char const *orig, MyString &answer )
MyString ft_clause;
if( strlen(orig) ) {
- answer.sprintf( "(%s)", orig );
+ answer.formatstr( "(%s)", orig );
} else {
answer = "";
}
@@ -6975,7 +6975,7 @@ check_requirements( char const *orig, MyString &answer )
// )
//
MyString attrib;
- attrib.sprintf( "( ( time() + %s ) >= ( %s - %s ) ) && "\
+ attrib.formatstr( "( ( time() + %s ) >= ( %s - %s ) ) && "\
"( time() < ( %s + %s ) )",
ATTR_SCHEDD_INTERVAL,
ATTR_DEFERRAL_TIME,
@@ -7041,9 +7041,9 @@ full_path(const char *name, bool use_iwd)
#else
if( name[0] == '/' ) { /* absolute wrt whatever the root is */
- pathname.sprintf( "%s%s", JobRootdir.Value(), name );
+ pathname.formatstr( "%s%s", JobRootdir.Value(), name );
} else { /* relative to iwd which is relative to the root */
- pathname.sprintf( "%s/%s/%s", JobRootdir.Value(), p_iwd, name );
+ pathname.formatstr( "%s/%s/%s", JobRootdir.Value(), p_iwd, name );
}
#endif
@@ -7567,7 +7567,7 @@ InsertJobExprInt(const char * name, int val, bool clustercheck /*= true*/)
{
ASSERT(name);
MyString buf;
- buf.sprintf("%s = %d", name, val);
+ buf.formatstr("%s = %d", name, val);
InsertJobExpr(buf.Value(), clustercheck);
}
@@ -7578,7 +7578,7 @@ InsertJobExprString(const char * name, const char * val, bool clustercheck /*= t
ASSERT(val);
MyString buf;
MyString esc;
- buf.sprintf("%s = \"%s\"", name, ClassAd::EscapeStringValue(val, esc));
+ buf.formatstr("%s = \"%s\"", name, ClassAd::EscapeStringValue(val, esc));
InsertJobExpr(buf.Value(), clustercheck);
}
@@ -7705,7 +7705,7 @@ void transfer_vm_file(const char *filename)
transfer_file_list.append(fixedname.Value());
tmp_ptr = transfer_file_list.print_to_string();
- buffer.sprintf( "%s = \"%s\"", ATTR_TRANSFER_INPUT_FILES, tmp_ptr);
+ buffer.formatstr( "%s = \"%s\"", ATTR_TRANSFER_INPUT_FILES, tmp_ptr);
InsertJobExpr(buffer);
free(tmp_ptr);
@@ -7875,7 +7875,7 @@ void SetVMRequirements()
}
MyString my_fsdomain;
if(job->LookupString(ATTR_FILE_SYSTEM_DOMAIN, my_fsdomain) != 1) {
- buffer.sprintf( "%s = \"%s\"", ATTR_FILE_SYSTEM_DOMAIN,
+ buffer.formatstr( "%s = \"%s\"", ATTR_FILE_SYSTEM_DOMAIN,
My_fs_domain );
InsertJobExpr( buffer );
}
@@ -7899,7 +7899,7 @@ void SetVMRequirements()
vmanswer += " >= ";
MyString mem_tmp;
- mem_tmp.sprintf("%d", VMMemoryMb);
+ mem_tmp.formatstr("%d", VMMemoryMb);
vmanswer += mem_tmp.Value();
vmanswer += ")";
}
@@ -7913,7 +7913,7 @@ void SetVMRequirements()
vmanswer += " >= ";
MyString mem_tmp;
- mem_tmp.sprintf("%d", VMMemoryMb);
+ mem_tmp.formatstr("%d", VMMemoryMb);
vmanswer += mem_tmp.Value();
vmanswer += ")";
}
@@ -7974,7 +7974,7 @@ void SetVMRequirements()
}
}
- buffer.sprintf( "%s = %s", ATTR_REQUIREMENTS, vmanswer.Value());
+ buffer.formatstr( "%s = %s", ATTR_REQUIREMENTS, vmanswer.Value());
JobRequirements = vmanswer;
InsertJobExpr (buffer);
}
@@ -7995,7 +7995,7 @@ SetConcurrencyLimits()
str = list.print_to_string();
if ( str ) {
- tmp.sprintf("%s = \"%s\"", ATTR_CONCURRENCY_LIMITS, str);
+ tmp.formatstr("%s = \"%s\"", ATTR_CONCURRENCY_LIMITS, str);
InsertJobExpr(tmp.Value());
free(str);
@@ -8015,18 +8015,18 @@ SetVMParams()
MyString buffer;
// VM type is already set in SetUniverse
- buffer.sprintf( "%s = \"%s\"", ATTR_JOB_VM_TYPE, VMType.Value());
+ buffer.formatstr( "%s = \"%s\"", ATTR_JOB_VM_TYPE, VMType.Value());
InsertJobExpr(buffer);
// VM checkpoint is already set in SetUniverse
- buffer.sprintf( "%s = %s", ATTR_JOB_VM_CHECKPOINT, VMCheckpoint? "TRUE":"FALSE");
+ buffer.formatstr( "%s = %s", ATTR_JOB_VM_CHECKPOINT, VMCheckpoint? "TRUE":"FALSE");
InsertJobExpr(buffer);
// VM networking is already set in SetUniverse
- buffer.sprintf( "%s = %s", ATTR_JOB_VM_NETWORKING, VMNetworking? "TRUE":"FALSE");
+ buffer.formatstr( "%s = %s", ATTR_JOB_VM_NETWORKING, VMNetworking? "TRUE":"FALSE");
InsertJobExpr(buffer);
- buffer.sprintf( "%s = %s", ATTR_JOB_VM_VNC, VMVNC? "TRUE":"FALSE");
+ buffer.formatstr( "%s = %s", ATTR_JOB_VM_VNC, VMVNC? "TRUE":"FALSE");
InsertJobExpr(buffer);
// Here we need to set networking type
@@ -8036,7 +8036,7 @@ SetVMParams()
VMNetworkType = tmp_ptr;
free(tmp_ptr);
- buffer.sprintf( "%s = \"%s\"", ATTR_JOB_VM_NETWORKING_TYPE,
+ buffer.formatstr( "%s = \"%s\"", ATTR_JOB_VM_NETWORKING_TYPE,
VMNetworkType.Value());
InsertJobExpr(buffer);
}else {
@@ -8064,7 +8064,7 @@ SetVMParams()
DoCleanup(0,0,NULL);
exit(1);
}
- buffer.sprintf( "%s = %d", ATTR_JOB_VM_MEMORY, VMMemoryMb);
+ buffer.formatstr( "%s = %d", ATTR_JOB_VM_MEMORY, VMMemoryMb);
InsertJobExpr( buffer );
/*
@@ -8081,7 +8081,7 @@ SetVMParams()
{
VMVCPUS = 1;
}
- buffer.sprintf("%s = %d", ATTR_JOB_VM_VCPUS, VMVCPUS);
+ buffer.formatstr("%s = %d", ATTR_JOB_VM_VCPUS, VMVCPUS);
InsertJobExpr(buffer);
/*
@@ -8090,7 +8090,7 @@ SetVMParams()
tmp_ptr = condor_param(VM_MACAddr, ATTR_JOB_VM_MACADDR);
if(tmp_ptr)
{
- buffer.sprintf("%s = \"%s\"", ATTR_JOB_VM_MACADDR, tmp_ptr);
+ buffer.formatstr("%s = \"%s\"", ATTR_JOB_VM_MACADDR, tmp_ptr);
InsertJobExpr(buffer);
}
@@ -8110,7 +8110,7 @@ SetVMParams()
parse_vm_option(tmp_ptr, vm_no_output_vm);
free(tmp_ptr);
if( vm_no_output_vm ) {
- buffer.sprintf( "%s = TRUE", VMPARAM_NO_OUTPUT_VM);
+ buffer.formatstr( "%s = TRUE", VMPARAM_NO_OUTPUT_VM);
InsertJobExpr( buffer );
}
}
@@ -8163,7 +8163,7 @@ SetVMParams()
real_xen_kernel_file = false;
need_xen_root_device = false;
VMHardwareVT = true;
- buffer.sprintf( "%s = TRUE", ATTR_JOB_VM_HARDWARE_VT);
+ buffer.formatstr( "%s = TRUE", ATTR_JOB_VM_HARDWARE_VT);
InsertJobExpr( buffer );
}else {
// real kernel file
@@ -8175,7 +8175,7 @@ SetVMParams()
real_xen_kernel_file = true;
need_xen_root_device = true;
}
- buffer.sprintf( "%s = \"%s\"", VMPARAM_XEN_KERNEL,
+ buffer.formatstr( "%s = \"%s\"", VMPARAM_XEN_KERNEL,
fixedname.Value());
InsertJobExpr(buffer);
free(xen_kernel);
@@ -8198,7 +8198,7 @@ SetVMParams()
DoCleanup(0,0,NULL);
exit(1);
}
- buffer.sprintf( "%s = \"%s\"", VMPARAM_XEN_INITRD,
+ buffer.formatstr( "%s = \"%s\"", VMPARAM_XEN_INITRD,
fixedname.Value());
InsertJobExpr(buffer);
free(xen_initrd);
@@ -8216,7 +8216,7 @@ SetVMParams()
exit(1);
}else {
MyString fixedvalue = delete_quotation_marks(xen_root);
- buffer.sprintf( "%s = \"%s\"", VMPARAM_XEN_ROOT,
+ buffer.formatstr( "%s = \"%s\"", VMPARAM_XEN_ROOT,
fixedvalue.Value());
InsertJobExpr(buffer);
free(xen_root);
@@ -8249,7 +8249,7 @@ SetVMParams()
exit(1);
}
- buffer.sprintf( "%s = \"%s\"", disk_attr_name, fixedvalue.Value());
+ buffer.formatstr( "%s = \"%s\"", disk_attr_name, fixedvalue.Value());
InsertJobExpr( buffer );
free(disk);
}
@@ -8261,7 +8261,7 @@ SetVMParams()
xen_kernel_params = condor_param("xen_kernel_params");
if( xen_kernel_params ) {
MyString fixedvalue = delete_quotation_marks(xen_kernel_params);
- buffer.sprintf( "%s = \"%s\"", VMPARAM_XEN_KERNEL_PARAMS,
+ buffer.formatstr( "%s = \"%s\"", VMPARAM_XEN_KERNEL_PARAMS,
fixedvalue.Value());
InsertJobExpr( buffer );
free(xen_kernel_params);
@@ -8291,7 +8291,7 @@ SetVMParams()
}
free(tmp_ptr);
- buffer.sprintf( "%s = %s", VMPARAM_VMWARE_TRANSFER,
+ buffer.formatstr( "%s = %s", VMPARAM_VMWARE_TRANSFER,
vmware_should_transfer_files ? "TRUE" : "FALSE");
InsertJobExpr( buffer );
@@ -8327,7 +8327,7 @@ SetVMParams()
exit( 1 );
}
- buffer.sprintf( "%s = %s", VMPARAM_VMWARE_SNAPSHOTDISK,
+ buffer.formatstr( "%s = %s", VMPARAM_VMWARE_SNAPSHOTDISK,
vmware_snapshot_disk? "TRUE" : "FALSE");
InsertJobExpr( buffer );
@@ -8341,7 +8341,7 @@ SetVMParams()
f_dirname = full_path(f_dirname.Value(), false);
check_and_universalize_path(f_dirname);
- buffer.sprintf( "%s = \"%s\"", VMPARAM_VMWARE_DIR, f_dirname.Value());
+ buffer.formatstr( "%s = \"%s\"", VMPARAM_VMWARE_DIR, f_dirname.Value());
InsertJobExpr( buffer );
Directory dir( f_dirname.Value() );
@@ -8383,14 +8383,14 @@ SetVMParams()
exit(1);
} else {
vmx_files.rewind();
- buffer.sprintf( "%s = \"%s\"", VMPARAM_VMWARE_VMX_FILE,
+ buffer.formatstr( "%s = \"%s\"", VMPARAM_VMWARE_VMX_FILE,
condor_basename(vmx_files.next()));
InsertJobExpr( buffer );
}
tmp_ptr = vmdk_files.print_to_string();
if ( tmp_ptr ) {
- buffer.sprintf( "%s = \"%s\"", VMPARAM_VMWARE_VMDK_FILES, tmp_ptr);
+ buffer.formatstr( "%s = \"%s\"", VMPARAM_VMWARE_VMDK_FILES, tmp_ptr);
InsertJobExpr( buffer );
free( tmp_ptr );
}
diff --git a/src/condor_tools/advertise.cpp b/src/condor_tools/advertise.cpp
index 04681f1..9a7bef9 100644
--- a/src/condor_tools/advertise.cpp
+++ b/src/condor_tools/advertise.cpp
@@ -207,7 +207,7 @@ int main( int argc, char *argv[] )
// If there's no "MyAddress", generate one..
if( !ad->Lookup( ATTR_MY_ADDRESS ) ) {
MyString tmp;
- tmp.sprintf( "<%s:0>", my_ip_string() );
+ tmp.formatstr( "<%s:0>", my_ip_string() );
ad->Assign( ATTR_MY_ADDRESS, tmp.Value() );
}
diff --git a/src/condor_tools/condor_test_match.cpp b/src/condor_tools/condor_test_match.cpp
index 3cdcd32..b212e34 100644
--- a/src/condor_tools/condor_test_match.cpp
+++ b/src/condor_tools/condor_test_match.cpp
@@ -262,7 +262,7 @@ MatchTest::showJobAd(ClassAd *ad,char const *label)
int proc = -1;
ad->LookupInteger(ATTR_CLUSTER_ID,cluster);
ad->LookupInteger(ATTR_PROC_ID,proc);
- gid.sprintf("%d.%d",cluster,proc);
+ gid.formatstr("%d.%d",cluster,proc);
}
printf("%s: %s\n",label,gid.Value());
diff --git a/src/condor_tools/preen.cpp b/src/condor_tools/preen.cpp
index 3425d4b..4c87c3f 100644
--- a/src/condor_tools/preen.cpp
+++ b/src/condor_tools/preen.cpp
@@ -208,7 +208,7 @@ produce_output()
char *str;
FILE *mailer;
MyString subject,szTmp;
- subject.sprintf("condor_preen results %s: %d old file%s found",
+ subject.formatstr("condor_preen results %s: %d old file%s found",
my_full_hostname(), BadFiles->number(),
(BadFiles->number() > 1)?"s":"");
@@ -220,7 +220,7 @@ produce_output()
mailer = stdout;
}
- szTmp.sprintf("The condor_preen process has found the following stale condor files on <%s>:\n\n", get_local_hostname().Value());
+ szTmp.formatstr("The condor_preen process has found the following stale condor files on <%s>:\n\n", get_local_hostname().Value());
dprintf(D_ALWAYS, "%s", szTmp.Value());
if( MailFlag ) {
@@ -229,7 +229,7 @@ produce_output()
}
for( BadFiles->rewind(); (str = BadFiles->next()); ) {
- szTmp.sprintf(" %s\n", str);
+ szTmp.formatstr(" %s\n", str);
dprintf(D_ALWAYS, "%s", szTmp.Value() );
fprintf( mailer, "%s", szTmp.Value() );
}
@@ -457,7 +457,7 @@ is_valid_shared_exe( const char *name )
return FALSE;
}
MyString path;
- path.sprintf("%s/%s", Spool, name);
+ path.formatstr("%s/%s", Spool, name);
int count = link_count(path.Value());
if (count == 1) {
return FALSE;
@@ -705,7 +705,7 @@ check_daemon_sock_dir()
while( (f = dir.Next()) ) {
MyString full_path;
- full_path.sprintf("%s%c%s",DaemonSockDir,DIR_DELIM_CHAR,f);
+ full_path.formatstr("%s%c%s",DaemonSockDir,DIR_DELIM_CHAR,f);
// daemon sockets are touched periodically to mark them as
// still in use
@@ -869,7 +869,7 @@ bad_file( const char *dirpath, const char *name, Directory & dir )
MyString buf;
if( is_relative_to_cwd( name ) ) {
- pathname.sprintf( "%s%c%s", dirpath, DIR_DELIM_CHAR, name );
+ pathname.formatstr( "%s%c%s", dirpath, DIR_DELIM_CHAR, name );
}
else {
pathname = name;
@@ -892,12 +892,12 @@ bad_file( const char *dirpath, const char *name, Directory & dir )
}
}
if( removed ) {
- buf.sprintf( "%s - Removed", pathname.Value() );
+ buf.formatstr( "%s - Removed", pathname.Value() );
} else {
- buf.sprintf( "%s - Can't Remove", pathname.Value() );
+ buf.formatstr( "%s - Can't Remove", pathname.Value() );
}
} else {
- buf.sprintf( "%s - Not Removed", pathname.Value() );
+ buf.formatstr( "%s - Not Removed", pathname.Value() );
}
BadFiles->append( buf.Value() );
}
diff --git a/src/condor_tools/qedit.cpp b/src/condor_tools/qedit.cpp
index e36d844..6395d2b 100644
--- a/src/condor_tools/qedit.cpp
+++ b/src/condor_tools/qedit.cpp
@@ -165,12 +165,12 @@ main(int argc, char *argv[])
}
UseConstraint = false;
} else {
- constraint.sprintf("(%s == %d)", ATTR_CLUSTER_ID, cluster);
+ constraint.formatstr("(%s == %d)", ATTR_CLUSTER_ID, cluster);
UseConstraint = true;
}
nextarg++;
} else {
- constraint.sprintf("(%s == \"%s\")", ATTR_OWNER, argv[nextarg]);
+ constraint.formatstr("(%s == \"%s\")", ATTR_OWNER, argv[nextarg]);
nextarg++;
UseConstraint = true;
}
diff --git a/src/condor_tools/ssh_to_job.cpp b/src/condor_tools/ssh_to_job.cpp
index 8b8fd6e..b0dbc33 100644
--- a/src/condor_tools/ssh_to_job.cpp
+++ b/src/condor_tools/ssh_to_job.cpp
@@ -474,7 +474,7 @@ bool SSHToJob::execute_ssh()
unsigned int num = 1;
for(num=1;num<2000;num++) {
unsigned int r = get_random_uint();
- m_session_dir.sprintf("%s%c%s.condor_ssh_to_job_%x",
+ m_session_dir.formatstr("%s%c%s.condor_ssh_to_job_%x",
temp_dir,DIR_DELIM_CHAR,local_username,r);
if( mkdir(m_session_dir.Value(),0700)==0 ) {
break;
@@ -494,9 +494,9 @@ bool SSHToJob::execute_ssh()
MyString known_hosts_file;
- known_hosts_file.sprintf("%s%cknown_hosts",m_session_dir.Value(),DIR_DELIM_CHAR);
+ known_hosts_file.formatstr("%s%cknown_hosts",m_session_dir.Value(),DIR_DELIM_CHAR);
MyString private_client_key_file;
- private_client_key_file.sprintf("%s%cssh_key",m_session_dir.Value(),DIR_DELIM_CHAR);
+ private_client_key_file.formatstr("%s%cssh_key",m_session_dir.Value(),DIR_DELIM_CHAR);
ReliSock sock;
MyString remote_user; // this will be filled in with the remote user name
@@ -520,7 +520,7 @@ bool SSHToJob::execute_ssh()
MyString fdpass_sock_name;
- fdpass_sock_name.sprintf("%s%cfdpass",m_session_dir.Value(),DIR_DELIM_CHAR);
+ fdpass_sock_name.formatstr("%s%cfdpass",m_session_dir.Value(),DIR_DELIM_CHAR);
// because newer versions of openssh (e.g. 5.8) close
// all file descriptors > 2, we have to pass the ssh connection
@@ -638,9 +638,9 @@ bool SSHToJob::execute_ssh()
MyString ssh_cmd;
ArgList ssh_arglist;
MyString param_name;
- param_name.sprintf("SSH_TO_JOB_%s_CMD",m_ssh_basename.Value());
+ param_name.formatstr("SSH_TO_JOB_%s_CMD",m_ssh_basename.Value());
MyString default_ssh_cmd;
- default_ssh_cmd.sprintf("\"%s -oUser=%%u -oIdentityFile=%%i -oStrictHostKeyChecking=yes -oUserKnownHostsFile=%%k -oGlobalKnownHostsFile=%%k -oProxyCommand=%%x%s\"",
+ default_ssh_cmd.formatstr("\"%s -oUser=%%u -oIdentityFile=%%i -oStrictHostKeyChecking=yes -oUserKnownHostsFile=%%k -oGlobalKnownHostsFile=%%k -oProxyCommand=%%x%s\"",
ssh_options_arglist.GetArg(0),
is_scp ? "" : " condor-job.%h");
param(ssh_cmd,param_name.Value(),default_ssh_cmd.Value());
diff --git a/src/condor_tools/store_cred_main.cpp b/src/condor_tools/store_cred_main.cpp
index 04748e7..146319e 100644
--- a/src/condor_tools/store_cred_main.cpp
+++ b/src/condor_tools/store_cred_main.cpp
@@ -109,7 +109,7 @@ int main(int argc, char *argv[]) {
char* my_name = my_username();
char* my_domain = my_domainname();
- my_full_name.sprintf("%s@%s", my_name, my_domain);
+ my_full_name.formatstr("%s@%s", my_name, my_domain);
if ( my_name) { free(my_name); }
if ( my_domain) { free(my_domain); }
my_name = my_domain = NULL;
@@ -133,7 +133,7 @@ int main(int argc, char *argv[]) {
goto cleanup;
}
}
- my_full_name.sprintf(POOL_PASSWORD_USERNAME "@%s", domain);
+ my_full_name.formatstr(POOL_PASSWORD_USERNAME "@%s", domain);
free(domain);
} else {
// username was specified on the command line
diff --git a/src/condor_tools/transfer_data.cpp b/src/condor_tools/transfer_data.cpp
index 37090b8..5faa3b9 100644
--- a/src/condor_tools/transfer_data.cpp
+++ b/src/condor_tools/transfer_data.cpp
@@ -106,7 +106,7 @@ procArg(const char* arg)
if(*tmp == '\0')
// delete the cluster
{
- constraint.sprintf( "%s==%d", ATTR_CLUSTER_ID, c );
+ constraint.formatstr( "%s==%d", ATTR_CLUSTER_ID, c );
addConstraint(constraint.Value());
return;
}
@@ -122,7 +122,7 @@ procArg(const char* arg)
if(*tmp == '\0')
// process a proc
{
- constraint.sprintf( "(%s==%d && %s==%d)",
+ constraint.formatstr( "(%s==%d && %s==%d)",
ATTR_CLUSTER_ID, c,
ATTR_PROC_ID, p);
addConstraint(constraint.Value());
@@ -135,7 +135,7 @@ procArg(const char* arg)
else if(isalpha(*arg))
// process by user name
{
- constraint.sprintf( "%s == \"%s\"", ATTR_OWNER, arg );
+ constraint.formatstr( "%s == \"%s\"", ATTR_OWNER, arg );
addConstraint(constraint.Value());
} else {
fprintf( stderr, "Warning: unrecognized \"%s\" skipped\n", arg );
diff --git a/src/condor_tools/user_prio.cpp b/src/condor_tools/user_prio.cpp
index cb86406..3da5d98 100644
--- a/src/condor_tools/user_prio.cpp
+++ b/src/condor_tools/user_prio.cpp
@@ -837,8 +837,8 @@ static void CollectInfo(int numElem, AttrList* ad, LineRec* LR, bool GroupRollup
sprintf( attrBeginUsage , "BeginUsageTime%d", i );
sprintf( attrLastUsage , "LastUsageTime%d", i );
sprintf( attrAccUsage , "WeightedAccumulatedUsage%d", i );
- attrAcctGroup.sprintf("AccountingGroup%d", i);
- attrIsAcctGroup.sprintf("IsAccountingGroup%d", i);
+ attrAcctGroup.formatstr("AccountingGroup%d", i);
+ attrIsAcctGroup.formatstr("IsAccountingGroup%d", i);
if( !ad->LookupString ( attrName, name, COUNTOF(name) ) ||
!ad->LookupFloat ( attrPrio, priority ) )
diff --git a/src/condor_transferd/td_maint.cpp b/src/condor_transferd/td_maint.cpp
index b284df2..2a1381d 100644
--- a/src/condor_transferd/td_maint.cpp
+++ b/src/condor_transferd/td_maint.cpp
@@ -52,11 +52,11 @@ TransferD::dump_state_handler(int /*cmd*/, Stream *sock)
dprintf(D_ALWAYS, "Got a DUMP_STATE!\n");
// what uid am I running under?
- tmp.sprintf("Uid = %d", getuid());
+ tmp.formatstr("Uid = %d", getuid());
state.InsertOrUpdate(tmp.Value());
// count how many pending requests I've had
- tmp.sprintf("OutstandingTransferRequests = %d", m_treqs.getNumElements());
+ tmp.formatstr("OutstandingTransferRequests = %d", m_treqs.getNumElements());
state.InsertOrUpdate(tmp.Value());
// add more later
diff --git a/src/condor_transferd/td_read_files.cpp b/src/condor_transferd/td_read_files.cpp
index a6c7f87..e267b43 100644
--- a/src/condor_transferd/td_read_files.cpp
+++ b/src/condor_transferd/td_read_files.cpp
@@ -354,7 +354,7 @@ TransferD::read_files_reaper(int tid, int exit_status)
result.Assign(ATTR_TREQ_SIGNALED, TRUE);
result.Assign(ATTR_TREQ_SIGNAL, signal);
result.Assign(ATTR_TREQ_UPDATE_STATUS, "NOT OK");
- str.sprintf("Died with signal %d", signal);
+ str.formatstr("Died with signal %d", signal);
result.Assign(ATTR_TREQ_UPDATE_REASON, str);
} else {
@@ -372,7 +372,7 @@ TransferD::read_files_reaper(int tid, int exit_status)
default:
result.Assign(ATTR_TREQ_UPDATE_STATUS, "NOT OK");
- str.sprintf("File transfer exited with incorrect exit code %d",
+ str.formatstr("File transfer exited with incorrect exit code %d",
exit_code);
result.Assign(ATTR_TREQ_UPDATE_REASON, str);
result.Assign(ATTR_TREQ_SIGNALED, FALSE);
diff --git a/src/condor_transferd/td_write_files.cpp b/src/condor_transferd/td_write_files.cpp
index 412a552..1b235ee 100644
--- a/src/condor_transferd/td_write_files.cpp
+++ b/src/condor_transferd/td_write_files.cpp
@@ -367,7 +367,7 @@ TransferD::write_files_reaper(int tid, int exit_status)
dprintf(D_ALWAYS, "Thread exited with signal: %d\n", signal);
result.Assign(ATTR_TREQ_UPDATE_STATUS, "NOT OK");
- str.sprintf("Died with signal %d", signal);
+ str.formatstr("Died with signal %d", signal);
result.Assign(ATTR_TREQ_UPDATE_REASON, str);
result.Assign(ATTR_TREQ_SIGNALED, TRUE);
@@ -385,7 +385,7 @@ TransferD::write_files_reaper(int tid, int exit_status)
default:
result.Assign(ATTR_TREQ_UPDATE_STATUS, "NOT OK");
- str.sprintf("Exited with bad exit code %d", exit_code);
+ str.formatstr("Exited with bad exit code %d", exit_code);
result.Assign(ATTR_TREQ_UPDATE_REASON, str);
result.Assign(ATTR_TREQ_SIGNALED, FALSE);
result.Assign(ATTR_TREQ_EXIT_CODE, exit_code);
diff --git a/src/condor_utils/ClassAdReevaluator.cpp b/src/condor_utils/ClassAdReevaluator.cpp
index 0ac74b6..0b8ffdc 100644
--- a/src/condor_utils/ClassAdReevaluator.cpp
+++ b/src/condor_utils/ClassAdReevaluator.cpp
@@ -54,7 +54,7 @@ classad_reevaluate(ClassAd *ad, ClassAd *context)
reevaluate_attrs->rewind();
while (NULL != (atmp = reevaluate_attrs->next())) {
- stmp.sprintf("REEVALUATE_%s_EXPR", atmp);
+ stmp.formatstr("REEVALUATE_%s_EXPR", atmp);
dprintf(D_FULLDEBUG,
"classad_reevaluate: Attempting reevaluate %s with %s\n",
diff --git a/src/condor_utils/KeyCache.cpp b/src/condor_utils/KeyCache.cpp
index bf33fff..b905c7a 100644
--- a/src/condor_utils/KeyCache.cpp
+++ b/src/condor_utils/KeyCache.cpp
@@ -284,7 +284,7 @@ KeyCache::makeServerUniqueId(MyString const &parent_id,int server_pid,MyString *
// never query by PID alone.
return;
}
- result->sprintf("%s.%d",parent_id.Value(),server_pid);
+ result->formatstr("%s.%d",parent_id.Value(),server_pid);
}
bool KeyCache::lookup(const char *key_id, KeyCacheEntry *&e_ptr) {
diff --git a/src/condor_utils/MyString.cpp b/src/condor_utils/MyString.cpp
index 1c163f0..ac3db2e 100644
--- a/src/condor_utils/MyString.cpp
+++ b/src/condor_utils/MyString.cpp
@@ -611,7 +611,7 @@ MyString::formatstr(const char *format,...)
va_list args;
va_start(args, format);
- succeeded = vsprintf(format,args);
+ succeeded = vformatstr(format,args);
va_end(args);
return succeeded;
@@ -632,7 +632,7 @@ MyString::sprintf(const char *format,...)
va_list args;
va_start(args, format);
- succeeded = vsprintf(format,args);
+ succeeded = vformatstr(format,args);
va_end(args);
return succeeded;
diff --git a/src/condor_utils/ad_printmask.cpp b/src/condor_utils/ad_printmask.cpp
index 1624451..0df3c3f 100644
--- a/src/condor_utils/ad_printmask.cpp
+++ b/src/condor_utils/ad_printmask.cpp
@@ -343,7 +343,7 @@ display_Headings(List<const char> & headings)
MyString tmp_fmt;
if (fmt->width) {
- tmp_fmt.sprintf("%%-%ds", fmt->width);
+ tmp_fmt.formatstr("%%-%ds", fmt->width);
retval.sprintf_cat(tmp_fmt.Value(), pszHead);
} else {
retval += pszHead;
@@ -575,7 +575,7 @@ display (AttrList *al, AttrList *target /* = NULL */)
}
}
} else if( al->EvalString( attr, target, &value_from_classad ) ) {
- stringValue.sprintf( fmt->printfFmt,
+ stringValue.formatstr( fmt->printfFmt,
value_from_classad );
retval += stringValue;
free( value_from_classad );
@@ -583,7 +583,7 @@ display (AttrList *al, AttrList *target /* = NULL */)
} else {
bool_str = ExprTreeToString( tree );
if( bool_str ) {
- stringValue.sprintf(fmt->printfFmt, bool_str);
+ stringValue.formatstr(fmt->printfFmt, bool_str);
retval += stringValue;
} else {
if ( alt ) {
@@ -621,7 +621,7 @@ display (AttrList *al, AttrList *target /* = NULL */)
} else {
sprintf(tfmt, "%%%d.%ds", width, fmt->width);
}
- stringValue.sprintf( tfmt, pszValue );
+ stringValue.formatstr( tfmt, pszValue );
}
} else {
char * tfmt = strdup(fmt->printfFmt); ASSERT(tfmt);
@@ -629,7 +629,7 @@ display (AttrList *al, AttrList *target /* = NULL */)
//bool fQuote = (*ptag == 'V');
if (*ptag == 'v' || *ptag == 'V')
*ptag = 's'; // convert printf format to %s
- stringValue.sprintf( tfmt, pszValue );
+ stringValue.formatstr( tfmt, pszValue );
free(tfmt);
}
retval += stringValue;
@@ -673,10 +673,10 @@ display (AttrList *al, AttrList *target /* = NULL */)
double d;
result.IsRealValue( d );
if( fmt_type == PFT_INT ) {
- stringValue.sprintf( fmt->printfFmt,
+ stringValue.formatstr( fmt->printfFmt,
(int)d );
} else {
- stringValue.sprintf( fmt->printfFmt,
+ stringValue.formatstr( fmt->printfFmt,
(float)d );
}
retval += stringValue;
@@ -686,10 +686,10 @@ display (AttrList *al, AttrList *target /* = NULL */)
int i;
result.IsIntegerValue( i );
if( fmt_type == PFT_INT ) {
- stringValue.sprintf( fmt->printfFmt,
+ stringValue.formatstr( fmt->printfFmt,
i );
} else {
- stringValue.sprintf( fmt->printfFmt,
+ stringValue.formatstr( fmt->printfFmt,
(float)i );
}
retval += stringValue;
@@ -699,10 +699,10 @@ display (AttrList *al, AttrList *target /* = NULL */)
bool b;
result.IsBooleanValue( b );
if( fmt_type == PFT_INT ) {
- stringValue.sprintf( fmt->printfFmt,
+ stringValue.formatstr( fmt->printfFmt,
b ? 1 : 0 );
} else {
- stringValue.sprintf( fmt->printfFmt,
+ stringValue.formatstr( fmt->printfFmt,
b ? 1.0 : 0.0 );
}
retval += stringValue;
diff --git a/src/condor_utils/classadHistory.cpp b/src/condor_utils/classadHistory.cpp
index e06a2a7..3dfeaae 100644
--- a/src/condor_utils/classadHistory.cpp
+++ b/src/condor_utils/classadHistory.cpp
@@ -556,9 +556,9 @@ void WritePerJobHistoryFile(ClassAd* ad, bool useGjid)
if (useGjid) {
MyString gjid;
ad->LookupString(ATTR_GLOBAL_JOB_ID, gjid);
- file_name.sprintf("%s/history.%s", PerJobHistoryDir, gjid.Value());
+ file_name.formatstr("%s/history.%s", PerJobHistoryDir, gjid.Value());
} else {
- file_name.sprintf("%s/history.%d.%d", PerJobHistoryDir, cluster, proc);
+ file_name.formatstr("%s/history.%d.%d", PerJobHistoryDir, cluster, proc);
}
// write out the file
diff --git a/src/condor_utils/classad_cron_job.cpp b/src/condor_utils/classad_cron_job.cpp
index bc99bfe..35d92a0 100644
--- a/src/condor_utils/classad_cron_job.cpp
+++ b/src/condor_utils/classad_cron_job.cpp
@@ -125,7 +125,7 @@ ClassAdCronJob::ProcessOutput( const char *line )
const char *lu_prefix = GetPrefix( );
if ( lu_prefix ) {
MyString Update;
- Update.sprintf( "%sLastUpdate = %ld",
+ Update.formatstr( "%sLastUpdate = %ld",
lu_prefix, (long) time(NULL) );
const char *UpdateStr = Update.Value( );
diff --git a/src/condor_utils/classad_hashtable.cpp b/src/condor_utils/classad_hashtable.cpp
index 422da39..2845c87 100644
--- a/src/condor_utils/classad_hashtable.cpp
+++ b/src/condor_utils/classad_hashtable.cpp
@@ -29,7 +29,7 @@ void HashKey::sprint(char *s)
void HashKey::sprint(MyString &s)
{
- s.sprintf("%s", key);
+ s.formatstr("%s", key);
}
HashKey& HashKey::operator= (const HashKey& from)
diff --git a/src/condor_utils/classad_log.cpp b/src/condor_utils/classad_log.cpp
index f54d45a..784fc84 100644
--- a/src/condor_utils/classad_log.cpp
+++ b/src/condor_utils/classad_log.cpp
@@ -238,7 +238,7 @@ ClassAdLog::SaveHistoricalLogs()
if(!max_historical_logs) return true;
MyString new_histfile;
- if(!new_histfile.sprintf("%s.%lu",logFilename(),historical_sequence_number))
+ if(!new_histfile.formatstr("%s.%lu",logFilename(),historical_sequence_number))
{
dprintf(D_ALWAYS,"Aborting save of historical log: out of memory.\n");
return false;
@@ -252,7 +252,7 @@ ClassAdLog::SaveHistoricalLogs()
}
MyString old_histfile;
- if(!old_histfile.sprintf("%s.%lu",logFilename(),historical_sequence_number - max_historical_logs))
+ if(!old_histfile.formatstr("%s.%lu",logFilename(),historical_sequence_number - max_historical_logs))
{
dprintf(D_ALWAYS,"Aborting cleanup of historical logs: out of memory.\n");
return true; // this is not a fatal error
@@ -297,7 +297,7 @@ ClassAdLog::TruncLog()
return false;
}
- tmp_log_filename.sprintf( "%s.tmp", logFilename());
+ tmp_log_filename.formatstr( "%s.tmp", logFilename());
new_log_fd = safe_open_wrapper_follow(tmp_log_filename.Value(), O_RDWR | O_CREAT | O_LARGEFILE, 0600);
if (new_log_fd < 0) {
dprintf(D_ALWAYS, "failed to rotate log: safe_open_wrapper(%s) returns %d\n",
diff --git a/src/condor_utils/classad_visa.cpp b/src/condor_utils/classad_visa.cpp
index d65a770..1fe97be 100644
--- a/src/condor_utils/classad_visa.cpp
+++ b/src/condor_utils/classad_visa.cpp
@@ -99,7 +99,7 @@ classad_visa_write(ClassAd* ad,
// unique, e.g. if jobad.0.0 exists then jobad.0.0.0 and if
// jobad.0.0.0 exists then jobad.0.0.1 and so on
i = 0;
- filename.sprintf("jobad.%d.%d", cluster, proc);
+ filename.formatstr("jobad.%d.%d", cluster, proc);
ASSERT(dir_path != NULL);
file_path = dircat(dir_path, filename.Value());
while (-1 == (fd = safe_open_wrapper_follow(file_path,
@@ -112,7 +112,7 @@ classad_visa_write(ClassAd* ad,
}
delete[] file_path;
- filename.sprintf("jobad.%d.%d.%d", cluster, proc, i++);
+ filename.formatstr("jobad.%d.%d.%d", cluster, proc, i++);
file_path = dircat(dir_path, filename.Value());
}
diff --git a/src/condor_utils/compat_classad.cpp b/src/condor_utils/compat_classad.cpp
index 19cb60e..ff975f1 100644
--- a/src/condor_utils/compat_classad.cpp
+++ b/src/condor_utils/compat_classad.cpp
@@ -1384,7 +1384,7 @@ initFromString( char const *str,MyString *err_msg )
if (!Insert(exprbuf)) {
if( err_msg ) {
- err_msg->sprintf("Failed to parse ClassAd expression: '%s'",
+ err_msg->formatstr("Failed to parse ClassAd expression: '%s'",
exprbuf);
} else {
dprintf(D_ALWAYS,"Failed to parse ClassAd expression: '%s'\n",
diff --git a/src/condor_utils/condor_arglist.cpp b/src/condor_utils/condor_arglist.cpp
index 5df2549..4d18ebd 100644
--- a/src/condor_utils/condor_arglist.cpp
+++ b/src/condor_utils/condor_arglist.cpp
@@ -112,7 +112,7 @@ bool split_args(
}
if(!*args) {
if(error_msg) {
- error_msg->sprintf("Unbalanced quote starting here: %s",quote);
+ error_msg->formatstr("Unbalanced quote starting here: %s",quote);
}
return false;
}
@@ -372,7 +372,7 @@ ArgList::AppendArgsV1Raw_win32(char const *args,MyString *error_msg)
if(*args != '"') {
MyString msg;
- msg.sprintf("Unterminated quote in windows argument string starting here: %s",begin_quote);
+ msg.formatstr("Unterminated quote in windows argument string starting here: %s",begin_quote);
AddErrorMessage(msg.Value(),error_msg);
return false;
}
@@ -644,7 +644,7 @@ ArgList::GetArgsStringV1Raw(MyString *result,MyString *error_msg) const
while(it.Next(arg)) {
if(!IsSafeArgV1Value(arg->Value())) {
if(error_msg) {
- error_msg->sprintf("Cannot represent '%s' in V1 arguments syntax.",arg->Value());
+ error_msg->formatstr("Cannot represent '%s' in V1 arguments syntax.",arg->Value());
}
return false;
}
@@ -886,7 +886,7 @@ ArgList::V2QuotedToV2Raw(char const *v1_input,MyString *v2_raw,MyString *errmsg)
if(*v1_input) {
if(errmsg) {
MyString msg;
- msg.sprintf(
+ msg.formatstr(
"Unexpected characters following double-quote. "
"Did you forget to escape the double-quote by repeating it? "
"Here is the quote and trailing characters: %s\n",quote_terminated);
@@ -908,7 +908,7 @@ ArgList::V1WackedToV1Raw(char const *v1_input,MyString *v1_raw,MyString *errmsg)
if(*v1_input == '"') {
if(errmsg) {
MyString msg;
- msg.sprintf("Found illegal unescaped double-quote: %s",v1_input);
+ msg.formatstr("Found illegal unescaped double-quote: %s",v1_input);
AddErrorMessage(msg.Value(),errmsg);
}
return false;
diff --git a/src/condor_utils/condor_claimid_parser.h b/src/condor_utils/condor_claimid_parser.h
index 0fe197a..6e92593 100644
--- a/src/condor_utils/condor_claimid_parser.h
+++ b/src/condor_utils/condor_claimid_parser.h
@@ -37,7 +37,7 @@ class ClaimIdParser {
ClaimIdParser(char const *session_id,char const *session_info,char const *session_key):
m_suppress_session(false)
{
- m_claim_id.sprintf("%s#%s%s",
+ m_claim_id.formatstr("%s#%s%s",
session_id ? session_id : "",
session_info ? session_info : "",
session_key ? session_key : "");
@@ -57,7 +57,7 @@ class ClaimIdParser {
char const *str = m_claim_id.Value();
char const *end = strchr(str,'#');
int length = end ? end - str : 0;
- m_sinful_part.sprintf("%.*s",length,str);
+ m_sinful_part.formatstr("%.*s",length,str);
}
return m_sinful_part.Value();
}
@@ -66,7 +66,7 @@ class ClaimIdParser {
char const *str = m_claim_id.Value();
char const *end = strrchr(str,'#');
int length = end ? end - str : 0;
- m_public_part.sprintf("%.*s#...",length,str);
+ m_public_part.formatstr("%.*s#...",length,str);
}
return m_public_part.Value();
}
@@ -89,7 +89,7 @@ class ClaimIdParser {
char const *str = m_claim_id.Value();
char const *end = strrchr(str,'#');
int length = end ? end - str : 0;
- m_session_id.sprintf("%.*s",length,str);
+ m_session_id.formatstr("%.*s",length,str);
}
return m_session_id.Value();
}
@@ -127,7 +127,7 @@ class ClaimIdParser {
if(!endptr || endptr < ptr) {
return NULL;
}
- m_session_info.sprintf("%.*s",(int)(endptr+1-ptr),ptr);
+ m_session_info.formatstr("%.*s",(int)(endptr+1-ptr),ptr);
}
if( m_session_info.IsEmpty() ) {
diff --git a/src/condor_utils/condor_config.cpp b/src/condor_utils/condor_config.cpp
index 596abf2..32867e9 100644
--- a/src/condor_utils/condor_config.cpp
+++ b/src/condor_utils/condor_config.cpp
@@ -150,14 +150,14 @@ config_fill_ad( ClassAd* ad, const char *prefix )
prefix = get_mySubSystem()->getLocalName();
}
- buffer.sprintf( "%s_EXPRS", get_mySubSystem()->getName() );
+ buffer.formatstr( "%s_EXPRS", get_mySubSystem()->getName() );
tmp = param( buffer.Value() );
if( tmp ) {
reqdExprs.initializeFromString (tmp);
free (tmp);
}
- buffer.sprintf( "%s_ATTRS", get_mySubSystem()->getName() );
+ buffer.formatstr( "%s_ATTRS", get_mySubSystem()->getName() );
tmp = param( buffer.Value() );
if( tmp ) {
reqdExprs.initializeFromString (tmp);
@@ -165,14 +165,14 @@ config_fill_ad( ClassAd* ad, const char *prefix )
}
if(prefix) {
- buffer.sprintf( "%s_%s_EXPRS", prefix, get_mySubSystem()->getName() );
+ buffer.formatstr( "%s_%s_EXPRS", prefix, get_mySubSystem()->getName() );
tmp = param( buffer.Value() );
if( tmp ) {
reqdExprs.initializeFromString (tmp);
free (tmp);
}
- buffer.sprintf( "%s_%s_ATTRS", prefix, get_mySubSystem()->getName() );
+ buffer.formatstr( "%s_%s_ATTRS", prefix, get_mySubSystem()->getName() );
tmp = param( buffer.Value() );
if( tmp ) {
reqdExprs.initializeFromString (tmp);
@@ -186,14 +186,14 @@ config_fill_ad( ClassAd* ad, const char *prefix )
while ((tmp = reqdExprs.next())) {
expr = NULL;
if(prefix) {
- buffer.sprintf("%s_%s", prefix, tmp);
+ buffer.formatstr("%s_%s", prefix, tmp);
expr = param(buffer.Value());
}
if(!expr) {
expr = param(tmp);
}
if(expr == NULL) continue;
- buffer.sprintf( "%s = %s", tmp, expr );
+ buffer.formatstr( "%s = %s", tmp, expr );
if( !ad->Insert( buffer.Value() ) ) {
dprintf(D_ALWAYS,
@@ -233,7 +233,7 @@ validate_entries( bool ignore_invalid_entry ) {
MyString filename;
int line_number;
param_get_location(name, filename, line_number);
- tmp.sprintf(" %s (found on line %d of %s)\n", name, line_number, filename.Value());
+ tmp.formatstr(" %s (found on line %d of %s)\n", name, line_number, filename.Value());
output += tmp;
invalid_entries++;
}
@@ -753,7 +753,7 @@ real_config(char* host, int wantsQuiet, bool wantExtraInfo)
// the general mechanism and set START itself --pfc]
if( !strcmp( macro_name, "START_owner" ) ) {
MyString ownerstr;
- ownerstr.sprintf( "Owner == \"%s\"", varvalue );
+ ownerstr.formatstr( "Owner == \"%s\"", varvalue );
insert( "START", ownerstr.Value(), ConfigTab, TABLESIZE );
extra_info->AddEnvironmentParam("START");
}
@@ -1057,7 +1057,7 @@ char*
find_global()
{
MyString file;
- file.sprintf( "%s_config", myDistro->Get() );
+ file.formatstr( "%s_config", myDistro->Get() );
return find_file( EnvGetName( ENV_CONFIG), file.Value() );
}
@@ -1127,12 +1127,12 @@ find_file(const char *env_name, const char *file_name)
file_name );
}
// 2) /etc/condor/condor_config
- locations[1].sprintf( "/etc/%s/%s", myDistro->Get(), file_name );
+ locations[1].formatstr( "/etc/%s/%s", myDistro->Get(), file_name );
// 3) /usr/local/etc/condor_config (FreeBSD)
- locations[2].sprintf( "/usr/local/etc/%s", file_name );
+ locations[2].formatstr( "/usr/local/etc/%s", file_name );
if (tilde) {
// 4) ~condor/condor_config
- locations[3].sprintf( "%s/%s", tilde, file_name );
+ locations[3].formatstr( "%s/%s", tilde, file_name );
}
int ctr;
@@ -1279,7 +1279,7 @@ fill_attributes()
int ver = sysapi_opsys_version();
if (ver > 0) {
- val.sprintf("%d", ver);
+ val.formatstr("%d", ver);
insert( "OPSYSVER", val.Value(), ConfigTab, TABLESIZE );
extra_info->AddInternalParam("OPSYSVER");
}
@@ -1297,7 +1297,7 @@ fill_attributes()
int major_ver = sysapi_opsys_major_version();
if (major_ver > 0) {
- val.sprintf("%d", major_ver);
+ val.formatstr("%d", major_ver);
insert( "OPSYS_MAJOR_VER", val.Value(), ConfigTab, TABLESIZE );
extra_info->AddInternalParam("OPSYS_MAJOR_VER");
}
@@ -1353,7 +1353,7 @@ fill_attributes()
insert( "SUBSYSTEM", get_mySubSystem()->getName(), ConfigTab, TABLESIZE );
extra_info->AddInternalParam("SUBSYSTEM");
- val.sprintf("%d",sysapi_phys_memory_raw_no_param());
+ val.formatstr("%d",sysapi_phys_memory_raw_no_param());
insert( "DETECTED_MEMORY", val.Value(), ConfigTab, TABLESIZE );
extra_info->AddInternalParam("DETECTED_MEMORY");
@@ -1368,7 +1368,7 @@ fill_attributes()
int num_hyperthread_cpus=0;
sysapi_ncpus_raw_no_param(&num_cpus,&num_hyperthread_cpus);
- val.sprintf("%d",num_hyperthread_cpus);
+ val.formatstr("%d",num_hyperthread_cpus);
insert( "DETECTED_CORES", val.Value(), ConfigTab, TABLESIZE );
extra_info->AddInternalParam("DETECTED_CORES");
}
@@ -2264,7 +2264,7 @@ init_dynamic_config()
// if we're using runtime config, try a subsys-specific config
// knob for the root location
MyString filename_parameter;
- filename_parameter.sprintf( "%s_CONFIG", get_mySubSystem()->getName() );
+ filename_parameter.formatstr( "%s_CONFIG", get_mySubSystem()->getName() );
tmp = param( filename_parameter.Value() );
if( tmp ) {
toplevel_persistent_config = tmp;
@@ -2293,7 +2293,7 @@ init_dynamic_config()
exit( 1 );
}
}
- toplevel_persistent_config.sprintf( "%s%c.config.%s", tmp,
+ toplevel_persistent_config.formatstr( "%s%c.config.%s", tmp,
DIR_DELIM_CHAR,
get_mySubSystem()->getName() );
free(tmp);
@@ -2345,8 +2345,8 @@ set_persistent_config(char *admin, char *config)
priv = set_root_priv();
if (config && config[0]) { // (re-)set config
// write new config to temporary file
- filename.sprintf( "%s.%s", toplevel_persistent_config.Value(), admin );
- tmp_filename.sprintf( "%s.tmp", filename.Value() );
+ filename.formatstr( "%s.%s", toplevel_persistent_config.Value(), admin );
+ tmp_filename.formatstr( "%s.tmp", filename.Value() );
do {
MSC_SUPPRESS_WARNING_FIXME(6031) // warning: return value of 'unlink' ignored.
unlink( tmp_filename.Value() );
@@ -2400,7 +2400,7 @@ set_persistent_config(char *admin, char *config)
}
// update admin list on disk
- tmp_filename.sprintf( "%s.tmp", toplevel_persistent_config.Value() );
+ tmp_filename.formatstr( "%s.tmp", toplevel_persistent_config.Value() );
do {
MSC_SUPPRESS_WARNING_FIXME(6031) // warning: return value of 'unlink' ignored.
unlink( tmp_filename.Value() );
@@ -2462,7 +2462,7 @@ set_persistent_config(char *admin, char *config)
// if we removed a config, then we should clean up by removing the file(s)
if (!config || !config[0]) {
- filename.sprintf( "%s.%s", toplevel_persistent_config.Value(), admin );
+ filename.formatstr( "%s.%s", toplevel_persistent_config.Value(), admin );
MSC_SUPPRESS_WARNING_FIXME(6031) // warning: return value of 'unlink' ignored.
unlink( filename.Value() );
if (PersistAdminList.number() == 0) {
@@ -2553,7 +2553,7 @@ process_persistent_configs()
while ((tmp = PersistAdminList.next())) {
processed = true;
MyString config_source;
- config_source.sprintf( "%s.%s", toplevel_persistent_config.Value(),
+ config_source.formatstr( "%s.%s", toplevel_persistent_config.Value(),
tmp );
rval = Read_config( config_source.Value(), ConfigTab, TABLESIZE,
EXPAND_LAZY, true, extra_info );
diff --git a/src/condor_utils/condor_event.cpp b/src/condor_utils/condor_event.cpp
index 016f991..9d2961a 100644
--- a/src/condor_utils/condor_event.cpp
+++ b/src/condor_utils/condor_event.cpp
@@ -598,9 +598,9 @@ static void writeUsageAd(FILE * file, ClassAd * pusageAd)
}
MyString fmt;
- fmt.sprintf("\tPartitionable Resources : %%%ds %%%ds %%%ds\n", cchUse, cchReq, MAX(cchAlloc,9));
+ fmt.formatstr("\tPartitionable Resources : %%%ds %%%ds %%%ds\n", cchUse, cchReq, MAX(cchAlloc,9));
fprintf(file, fmt.Value(), "Usage", "Request", cchAlloc ? "Allocated" : "");
- fmt.sprintf("\t %%-%ds : %%%ds %%%ds %%%ds\n", cchRes+8, cchUse, cchReq, MAX(cchAlloc,9));
+ fmt.formatstr("\t %%-%ds : %%%ds %%%ds %%%ds\n", cchRes+8, cchUse, cchReq, MAX(cchAlloc,9));
//fputs(fmt.Value(), file);
for (std::map<std::string, SlotResTermSumy*>::iterator it = useMap.begin();
it != useMap.end();
@@ -1439,7 +1439,7 @@ RemoteErrorEvent::writeEvent(FILE *file)
insertCommonIdentifiers(tmpCl2);
MyString tmp;
- tmp.sprintf("endtype = null");
+ tmp.formatstr("endtype = null");
tmpCl2.Insert(tmp.Value());
// critical error means this run is ended.
@@ -1765,16 +1765,16 @@ ExecuteEvent::writeEvent (FILE *file)
tmpCl1.Assign("endts", (int)eventclock);
- tmp.sprintf("endtype = -1");
+ tmp.formatstr("endtype = -1");
tmpCl1.Insert(tmp.Value());
- tmp.sprintf("endmessage = \"UNKNOWN ERROR\"");
+ tmp.formatstr("endmessage = \"UNKNOWN ERROR\"");
tmpCl1.Insert(tmp.Value());
// this inserts scheddname, cluster, proc, etc
insertCommonIdentifiers(tmpCl2);
- tmp.sprintf("endtype = null");
+ tmp.formatstr("endtype = null");
tmpCl2.Insert(tmp.Value());
if (FILEObj) {
@@ -1896,7 +1896,7 @@ ExecutableErrorEvent::writeEvent (FILE *file)
// this inserts scheddname, cluster, proc, etc
insertCommonIdentifiers(tmpCl2);
- tmp.sprintf( "endtype = null");
+ tmp.formatstr( "endtype = null");
tmpCl2.Insert(tmp.Value());
if (FILEObj) {
@@ -2404,7 +2404,7 @@ JobEvictedEvent::writeEvent( FILE *file )
tmpCl1.Assign("endts", (int)eventclock);
tmpCl1.Assign("endtype", ULOG_JOB_EVICTED);
- tmp.sprintf( "endmessage = \"%s%s\"", messagestr, terminatestr);
+ tmp.formatstr( "endmessage = \"%s%s\"", messagestr, terminatestr);
tmpCl1.Insert(tmp.Value());
tmpCl1.Assign("wascheckpointed", checkpointedstr);
@@ -2414,7 +2414,7 @@ JobEvictedEvent::writeEvent( FILE *file )
// this inserts scheddname, cluster, proc, etc
insertCommonIdentifiers(tmpCl2);
- tmp.sprintf( "endtype = null");
+ tmp.formatstr( "endtype = null");
tmpCl2.Insert(tmp.Value());
if (FILEObj) {
@@ -2974,7 +2974,7 @@ JobTerminatedEvent::writeEvent (FILE *file)
// this inserts scheddname, cluster, proc, etc
insertCommonIdentifiers(tmpCl2);
- tmp.sprintf( "endtype = null");
+ tmp.formatstr( "endtype = null");
tmpCl2.Insert(tmp.Value());
if (FILEObj) {
@@ -3319,7 +3319,7 @@ ShadowExceptionEvent::writeEvent (FILE *file)
// this inserts scheddname, cluster, proc, etc
insertCommonIdentifiers(tmpCl2);
- tmp.sprintf( "endtype = null");
+ tmp.formatstr( "endtype = null");
tmpCl2.Insert(tmp.Value());
if (FILEObj) {
diff --git a/src/condor_utils/condor_new_classads.cpp b/src/condor_utils/condor_new_classads.cpp
index f13504d..5c7aa6f 100644
--- a/src/condor_utils/condor_new_classads.cpp
+++ b/src/condor_utils/condor_new_classads.cpp
@@ -445,7 +445,7 @@ NewClassAdUnparser::OldValueToNewValue(char const *old_value,MyString &new_value
if( in_string ) {
if( err_msg ) {
- err_msg->sprintf("Unterminated string: %s",old_value);
+ err_msg->formatstr("Unterminated string: %s",old_value);
}
return false;
}
diff --git a/src/condor_utils/condor_sockaddr.cpp b/src/condor_utils/condor_sockaddr.cpp
index 2e1b354..c4714f4 100644
--- a/src/condor_utils/condor_sockaddr.cpp
+++ b/src/condor_utils/condor_sockaddr.cpp
@@ -160,10 +160,10 @@ MyString condor_sockaddr::to_sinful() const
return ret;
if (is_ipv4()) {
- ret.sprintf("<%s:%d>", tmp, ntohs(v4.sin_port));
+ ret.formatstr("<%s:%d>", tmp, ntohs(v4.sin_port));
}
else if (is_ipv6()) {
- ret.sprintf("<[%s]:%d>", tmp, ntohs(v6.sin6_port));
+ ret.formatstr("<[%s]:%d>", tmp, ntohs(v6.sin6_port));
}
return ret;
diff --git a/src/condor_utils/condor_user_policy.cpp b/src/condor_utils/condor_user_policy.cpp
index 3d78b3b..43cdb94 100644
--- a/src/condor_utils/condor_user_policy.cpp
+++ b/src/condor_utils/condor_user_policy.cpp
@@ -184,7 +184,7 @@ BaseUserPolicy::updateJobTime( float *old_run_time )
}
MyString buf;
- buf.sprintf( "%s = %f", ATTR_JOB_REMOTE_WALL_CLOCK, total_run_time );
+ buf.formatstr( "%s = %f", ATTR_JOB_REMOTE_WALL_CLOCK, total_run_time );
this->job_ad->InsertOrUpdate( buf.Value() );
}
@@ -202,6 +202,6 @@ BaseUserPolicy::restoreJobTime( float old_run_time )
}
MyString buf;
- buf.sprintf( "%s = %f", ATTR_JOB_REMOTE_WALL_CLOCK, old_run_time );
+ buf.formatstr( "%s = %f", ATTR_JOB_REMOTE_WALL_CLOCK, old_run_time );
this->job_ad->InsertOrUpdate( buf.Value() );
}
diff --git a/src/condor_utils/condor_xml_classads.cpp b/src/condor_utils/condor_xml_classads.cpp
index 56ac6fc..2b74b0a 100644
--- a/src/condor_utils/condor_xml_classads.cpp
+++ b/src/condor_utils/condor_xml_classads.cpp
@@ -673,12 +673,12 @@ ClassAdXMLUnparser::Unparse(const char *name, ExprTree *expression, MyString &bu
((classad::Literal *)expression)->GetValue(v);
print_expr = false;
if ( v.IsIntegerValue( int_number ) ) {
- number_string.sprintf("%d", int_number);
+ number_string.formatstr("%d", int_number);
add_tag(buffer, tag_Integer, true);
buffer += number_string;
add_tag(buffer, tag_Integer, false);
} else if ( v.IsRealValue( double_number ) ) {
- number_string.sprintf("%1.15E", double_number);
+ number_string.formatstr("%1.15E", double_number);
add_tag(buffer, tag_Real, true);
buffer += number_string;
add_tag(buffer, tag_Real, false);
diff --git a/src/condor_utils/domain_tools.cpp b/src/condor_utils/domain_tools.cpp
index 2288bab..0da8f82 100644
--- a/src/condor_utils/domain_tools.cpp
+++ b/src/condor_utils/domain_tools.cpp
@@ -58,6 +58,6 @@ joinDomainAndName( char const *domain, char const *name, class MyString &result
result = name;
}
else {
- result.sprintf("%s\\%s",domain,name);
+ result.formatstr("%s\\%s",domain,name);
}
}
diff --git a/src/condor_utils/email_cpp.cpp b/src/condor_utils/email_cpp.cpp
index 1770bb2..ad23636 100644
--- a/src/condor_utils/email_cpp.cpp
+++ b/src/condor_utils/email_cpp.cpp
@@ -304,7 +304,7 @@ Email::open_stream( ClassAd* ad, int exit_reason, const char* subject )
ad->LookupInteger( ATTR_PROC_ID, proc );
MyString full_subject;
- full_subject.sprintf( "Condor Job %d.%d", cluster, proc );
+ full_subject.formatstr( "Condor Job %d.%d", cluster, proc );
if( subject ) {
full_subject += " ";
full_subject += subject;
diff --git a/src/condor_utils/env.cpp b/src/condor_utils/env.cpp
index d7dcc7a..33df05e 100644
--- a/src/condor_utils/env.cpp
+++ b/src/condor_utils/env.cpp
@@ -511,12 +511,12 @@ Env::SetEnvWithErrorMessage( const char *nameValueExpr, MyString *error_msg )
if(error_msg) {
MyString msg;
if(delim == NULL) {
- msg.sprintf(
+ msg.formatstr(
"ERROR: Missing '=' after environment variable '%s'.",
nameValueExpr);
}
else {
- msg.sprintf("ERROR: missing variable in '%s'.",expr);
+ msg.formatstr("ERROR: missing variable in '%s'.",expr);
}
AddErrorMessage(msg.Value(),error_msg);
}
@@ -633,7 +633,7 @@ Env::getDelimitedStringV2Raw(MyString *result,MyString * /*error_msg*/,bool mark
}
else {
MyString var_val;
- var_val.sprintf("%s=%s",var.Value(),val.Value());
+ var_val.formatstr("%s=%s",var.Value(),val.Value());
env_list.Append(var_val);
}
}
@@ -683,7 +683,7 @@ Env::getDelimitedStringV1Raw(MyString *result,MyString *error_msg,char delim) co
if(error_msg) {
MyString msg;
- msg.sprintf("Environment entry is not compatible with V1 syntax: %s=%s",var.Value(),val.Value());
+ msg.formatstr("Environment entry is not compatible with V1 syntax: %s=%s",var.Value(),val.Value());
AddErrorMessage(msg.Value(),error_msg);
}
return false;
diff --git a/src/condor_utils/file_sql.cpp b/src/condor_utils/file_sql.cpp
index 61130a83..741eaad 100644
--- a/src/condor_utils/file_sql.cpp
+++ b/src/condor_utils/file_sql.cpp
@@ -439,7 +439,7 @@ FILESQL::createInstance(bool use_sql_log) {
MyString outfilename = "";
MyString param_name;
- param_name.sprintf("%s_SQLLOG", get_mySubSystem()->getName());
+ param_name.formatstr("%s_SQLLOG", get_mySubSystem()->getName());
char *tmp = param(param_name.Value());
if( tmp ) {
@@ -450,11 +450,11 @@ FILESQL::createInstance(bool use_sql_log) {
tmp = param ("LOG");
if (tmp) {
- outfilename.sprintf("%s/sql.log", tmp);
+ outfilename.formatstr("%s/sql.log", tmp);
free(tmp);
}
else {
- outfilename.sprintf("sql.log");
+ outfilename.formatstr("sql.log");
}
}
@@ -481,13 +481,13 @@ int &prevLHF)
// make a copy so that we can add timestamp attribute into it
clCopy = *cl;
- tmp.sprintf("%s = %d", "PrevLastReportedTime", prevLHF);
+ tmp.formatstr("%s = %d", "PrevLastReportedTime", prevLHF);
(&clCopy)->Insert(tmp.Value());
// set the lastReportedTime and make it the new prevLHF
prevLHF = (int)time(NULL);
- tmp.sprintf("%s = %d", "LastReportedTime", prevLHF);
+ tmp.formatstr("%s = %d", "LastReportedTime", prevLHF);
(&clCopy)->Insert(tmp.Value());
ASSERT( dbh );
diff --git a/src/condor_utils/file_transfer.cpp b/src/condor_utils/file_transfer.cpp
index b86e9d8..3e925be 100644
--- a/src/condor_utils/file_transfer.cpp
+++ b/src/condor_utils/file_transfer.cpp
@@ -376,7 +376,7 @@ FileTransfer::SimpleInit(ClassAd *Ad, bool want_check_perms, bool is_server,
int Proc = 0;
Ad->LookupInteger(ATTR_CLUSTER_ID, Cluster);
Ad->LookupInteger(ATTR_PROC_ID, Proc);
- m_jobid.sprintf("%d.%d",Cluster,Proc);
+ m_jobid.formatstr("%d.%d",Cluster,Proc);
if ( IsServer() && Spool ) {
SpoolSpace = gen_ckpt_name(Spool,Cluster,Proc,0);
@@ -1331,7 +1331,7 @@ FileTransfer::Reaper(Service *, int pid, int exit_status)
if( WIFSIGNALED(exit_status) ) {
transobject->Info.success = false;
transobject->Info.try_again = true;
- transobject->Info.error_desc.sprintf("File transfer failed (killed by signal=%d)", WTERMSIG(exit_status));
+ transobject->Info.error_desc.formatstr("File transfer failed (killed by signal=%d)", WTERMSIG(exit_status));
read_failed = true; // do not try to read from the pipe
dprintf( D_ALWAYS, "%s\n", transobject->Info.error_desc.Value() );
} else {
@@ -1435,7 +1435,7 @@ FileTransfer::Reaper(Service *, int pid, int exit_status)
transobject->Info.success = false;
transobject->Info.try_again = true;
if( transobject->Info.error_desc.IsEmpty() ) {
- transobject->Info.error_desc.sprintf("Failed to read status report from file transfer pipe (errno %d): %s",errno,strerror(errno));
+ transobject->Info.error_desc.formatstr("Failed to read status report from file transfer pipe (errno %d): %s",errno,strerror(errno));
dprintf(D_ALWAYS,"%s\n",transobject->Info.error_desc.Value());
}
}
@@ -1710,12 +1710,12 @@ FileTransfer::DoDownload( filesize_t *total_bytes, ReliSock *s)
fullname = remap_filename;
}
else {
- fullname.sprintf("%s%c%s",Iwd,DIR_DELIM_CHAR,remap_filename.Value());
+ fullname.formatstr("%s%c%s",Iwd,DIR_DELIM_CHAR,remap_filename.Value());
}
dprintf(D_FULLDEBUG,"Remapped downloaded file from %s to %s\n",filename.Value(),remap_filename.Value());
}
else {
- fullname.sprintf("%s%c%s",Iwd,DIR_DELIM_CHAR,filename.Value());
+ fullname.formatstr("%s%c%s",Iwd,DIR_DELIM_CHAR,filename.Value());
}
#ifdef WIN32
// check for write permission on this file, if we are supposed to check
@@ -1736,7 +1736,7 @@ FileTransfer::DoDownload( filesize_t *total_bytes, ReliSock *s)
}
#endif
} else {
- fullname.sprintf("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,filename.Value());
+ fullname.formatstr("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,filename.Value());
}
if( PeerDoesGoAhead ) {
@@ -1842,7 +1842,7 @@ FileTransfer::DoDownload( filesize_t *total_bytes, ReliSock *s)
// that hapens further down
rc = 0;
- error_buf.sprintf(
+ error_buf.formatstr(
"%s at %s failed due to remote transfer hook error: %s",
get_mySubSystem()->getName(),
s->my_ip_str(),fullname.Value());
@@ -1934,7 +1934,7 @@ FileTransfer::DoDownload( filesize_t *total_bytes, ReliSock *s)
rc = 0;
int the_error = errno;
- error_buf.sprintf(
+ error_buf.formatstr(
"%s at %s failed to create directory %s: %s (errno %d)",
get_mySubSystem()->getName(),
s->my_ip_str(),fullname.Value(),
@@ -1960,7 +1960,7 @@ FileTransfer::DoDownload( filesize_t *total_bytes, ReliSock *s)
if( rc < 0 ) {
int the_error = errno;
- error_buf.sprintf("%s at %s failed to receive file %s",
+ error_buf.formatstr("%s at %s failed to receive file %s",
get_mySubSystem()->getName(),
s->my_ip_str(),fullname.Value());
download_success = false;
@@ -2075,9 +2075,9 @@ FileTransfer::DoDownload( filesize_t *total_bytes, ReliSock *s)
}
MyString download_error_buf;
- download_error_buf.sprintf("%s failed to receive file(s) from %s",
+ download_error_buf.formatstr("%s failed to receive file(s) from %s",
get_mySubSystem()->getName(),peer_ip_str);
- error_buf.sprintf("%s; %s",
+ error_buf.formatstr("%s; %s",
upload_error_buf.Value(),
download_error_buf.Value());
dprintf(D_ALWAYS,"DoDownload: %s\n",error_buf.Value());
@@ -2108,7 +2108,7 @@ FileTransfer::DoDownload( filesize_t *total_bytes, ReliSock *s)
// we just stashed all the files in the TmpSpoolSpace.
// write out the commit file.
- buf.sprintf("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,COMMIT_FILENAME);
+ buf.formatstr("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,COMMIT_FILENAME);
#if defined(WIN32)
if ((fd = safe_open_wrapper_follow(buf.Value(), O_WRONLY | O_CREAT | O_TRUNC |
_O_BINARY | _O_SEQUENTIAL, 0644)) < 0)
@@ -2167,7 +2167,7 @@ FileTransfer::GetTransferAck(Stream *s,bool &success,bool &try_again,int &hold_c
try_again = false;
hold_code = CONDOR_HOLD_CODE_InvalidTransferAck;
hold_subcode = 0;
- error_desc.sprintf("Download acknowledgment missing attribute: %s",ATTR_RESULT);
+ error_desc.formatstr("Download acknowledgment missing attribute: %s",ATTR_RESULT);
return;
}
if(result == 0) {
@@ -2275,12 +2275,12 @@ FileTransfer::CommitFiles()
Directory tmpspool( TmpSpoolSpace, desired_priv_state );
- buf.sprintf("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,COMMIT_FILENAME);
+ buf.formatstr("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,COMMIT_FILENAME);
if ( access(buf.Value(),F_OK) >= 0 ) {
// the commit file exists, so commit the files.
MyString SwapSpoolSpace;
- SwapSpoolSpace.sprintf("%s.swap",SpoolSpace);
+ SwapSpoolSpace.formatstr("%s.swap",SpoolSpace);
bool swap_dir_ready = SpooledJobFiles::createJobSwapSpoolDirectory(&jobAd,desired_priv_state);
if( !swap_dir_ready ) {
EXCEPT("Failed to create %s",SwapSpoolSpace.Value());
@@ -2290,9 +2290,9 @@ FileTransfer::CommitFiles()
// don't commit the commit file!
if ( file_strcmp(file,COMMIT_FILENAME) == MATCH )
continue;
- buf.sprintf("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,file);
- newbuf.sprintf("%s%c%s",SpoolSpace,DIR_DELIM_CHAR,file);
- swapbuf.sprintf("%s%c%s",SwapSpoolSpace.Value(),DIR_DELIM_CHAR,file);
+ buf.formatstr("%s%c%s",TmpSpoolSpace,DIR_DELIM_CHAR,file);
+ newbuf.formatstr("%s%c%s",SpoolSpace,DIR_DELIM_CHAR,file);
+ swapbuf.formatstr("%s%c%s",SwapSpoolSpace.Value(),DIR_DELIM_CHAR,file);
// If the target name exists, move it into the swap
// directory. This serves two purposes:
@@ -2560,7 +2560,7 @@ FileTransfer::DoUpload(filesize_t *total_bytes, ReliSock *s)
dprintf(D_FULLDEBUG, "DoUpload: sending %s as URL.\n", filename);
} else if( filename[0] != '/' && filename[0] != '\\' && filename[1] != ':' ){
// looks like a relative path
- fullname.sprintf("%s%c%s",Iwd,DIR_DELIM_CHAR,filename);
+ fullname.formatstr("%s%c%s",Iwd,DIR_DELIM_CHAR,filename);
} else {
// looks like an unix absolute path or a windows path
fullname = filename;
@@ -2576,7 +2576,7 @@ FileTransfer::DoUpload(filesize_t *total_bytes, ReliSock *s)
is_the_executable = false;
if( dest_dir && *dest_dir ) {
- dest_filename.sprintf("%s%c",dest_dir,DIR_DELIM_CHAR);
+ dest_filename.formatstr("%s%c",dest_dir,DIR_DELIM_CHAR);
}
// condor_basename works for URLs
@@ -2885,7 +2885,7 @@ FileTransfer::DoUpload(filesize_t *total_bytes, ReliSock *s)
if( rc < 0 ) {
int the_error = errno;
upload_success = false;
- error_desc.sprintf("error sending %s",fullname.Value());
+ error_desc.formatstr("error sending %s",fullname.Value());
if((rc == PUT_FILE_OPEN_FAILED) || (rc == PUT_FILE_PLUGIN_FAILED)) {
if (rc == PUT_FILE_OPEN_FAILED) {
// In this case, put_file() has transmitted a zero-byte
@@ -3035,7 +3035,7 @@ FileTransfer::DoObtainAndSendTransferGoAhead(DCTransferQueue &xfer_queue,bool do
s->decode();
if( !s->get(alive_interval) || !s->end_of_message() ) {
- error_desc.sprintf("ObtainAndSendTransferGoAhead: failed on alive_interval before GoAhead");
+ error_desc.formatstr("ObtainAndSendTransferGoAhead: failed on alive_interval before GoAhead");
return false;
}
@@ -3054,7 +3054,7 @@ FileTransfer::DoObtainAndSendTransferGoAhead(DCTransferQueue &xfer_queue,bool do
s->encode();
if( !msg.put(*s) || !s->end_of_message() ) {
- error_desc.sprintf("Failed to send GoAhead new timeout message.");
+ error_desc.formatstr("Failed to send GoAhead new timeout message.");
}
}
ASSERT( timeout > alive_slop );
@@ -3113,7 +3113,7 @@ FileTransfer::DoObtainAndSendTransferGoAhead(DCTransferQueue &xfer_queue,bool do
}
}
if( !msg.put(*s) || !s->end_of_message() ) {
- error_desc.sprintf("Failed to send GoAhead message.");
+ error_desc.formatstr("Failed to send GoAhead message.");
try_again = true;
return false;
}
@@ -3192,7 +3192,7 @@ FileTransfer::DoReceiveTransferGoAhead(
s->encode();
if( !s->put(alive_interval) || !s->end_of_message() ) {
- error_desc.sprintf("DoReceiveTransferGoAhead: failed to send alive_interval");
+ error_desc.formatstr("DoReceiveTransferGoAhead: failed to send alive_interval");
return false;
}
@@ -3202,7 +3202,7 @@ FileTransfer::DoReceiveTransferGoAhead(
ClassAd msg;
if( !msg.initFromStream(*s) || !s->end_of_message() ) {
char const *ip = s->peer_ip_str();
- error_desc.sprintf("Failed to receive GoAhead message from %s.",
+ error_desc.formatstr("Failed to receive GoAhead message from %s.",
ip ? ip : "(null)");
return false;
@@ -3212,7 +3212,7 @@ FileTransfer::DoReceiveTransferGoAhead(
if(!msg.LookupInteger(ATTR_RESULT,go_ahead)) {
MyString msg_str;
msg.sPrint(msg_str);
- error_desc.sprintf("GoAhead message missing attribute: %s. "
+ error_desc.formatstr("GoAhead message missing attribute: %s. "
"Full classad: [\n%s]",
ATTR_RESULT,msg_str.Value());
try_again = false;
@@ -3310,7 +3310,7 @@ FileTransfer::ExitDoUpload(filesize_t *total_bytes, ReliSock *s, priv_state save
MyString error_desc_to_send;
if(!upload_success) {
- error_desc_to_send.sprintf("%s at %s failed to send file(s) to %s",
+ error_desc_to_send.formatstr("%s at %s failed to send file(s) to %s",
get_mySubSystem()->getName(),
s->my_ip_str(),
s->get_sinful_peer());
@@ -3343,7 +3343,7 @@ FileTransfer::ExitDoUpload(filesize_t *total_bytes, ReliSock *s, priv_state save
receiver_ip_str = "disconnected socket";
}
- error_buf.sprintf("%s at %s failed to send file(s) to %s",
+ error_buf.formatstr("%s at %s failed to send file(s) to %s",
get_mySubSystem()->getName(),
s->my_ip_str(),receiver_ip_str);
if(upload_error_desc) {
@@ -4094,7 +4094,7 @@ FileTransfer::ExpandInputFileList( ClassAd *job, MyString &error_msg ) {
MyString iwd;
if( job->LookupString(ATTR_JOB_IWD,iwd) != 1 )
{
- error_msg.sprintf("Failed to expand transfer input list because no IWD found in job ad.");
+ error_msg.formatstr("Failed to expand transfer input list because no IWD found in job ad.");
return false;
}
@@ -4138,7 +4138,7 @@ FileTransfer::LegalPathInSandbox(char const *path,char const *sandbox) {
bool more = true;
while( more ) {
MyString fullpath;
- fullpath.sprintf("%s%c%s",sandbox,DIR_DELIM_CHAR,pathbuf);
+ fullpath.formatstr("%s%c%s",sandbox,DIR_DELIM_CHAR,pathbuf);
more = filename_split( pathbuf, dirbuf, filebuf );
diff --git a/src/condor_utils/generic_stats.cpp b/src/condor_utils/generic_stats.cpp
index cd88269..4260d36 100644
--- a/src/condor_utils/generic_stats.cpp
+++ b/src/condor_utils/generic_stats.cpp
@@ -297,9 +297,9 @@ void stats_recent_counter_timer::Unpublish(ClassAd & ad, const char * pattr) con
{
ad.Delete(pattr);
MyString attr;
- attr.sprintf("Recent%s",pattr);
+ attr.formatstr("Recent%s",pattr);
ad.Delete(attr.Value());
- attr.sprintf("Recent%sRuntime",pattr);
+ attr.formatstr("Recent%sRuntime",pattr);
ad.Delete(attr.Value());
ad.Delete(attr.Value()+6); // +6 to skip "Recent" prefix
}
@@ -401,31 +401,31 @@ double Probe::Std() const
void ProbeToStringDebug(MyString & str, const Probe& probe)
{
- str.sprintf("%d M:%g m:%g S:%g s2:%g",
+ str.formatstr("%d M:%g m:%g S:%g s2:%g",
probe.Count, probe.Max, probe.Min, probe.Sum, probe.SumSq);
}
int ClassAdAssign(ClassAd & ad, const char * pattr, const Probe& probe)
{
MyString attr;
- attr.sprintf("%sCount", pattr);
+ attr.formatstr("%sCount", pattr);
ad.Assign(attr.Value(), probe.Count);
- attr.sprintf("%sSum", pattr);
+ attr.formatstr("%sSum", pattr);
int ret = ad.Assign(attr.Value(), probe.Sum);
if (probe.Count > 0)
{
- attr.sprintf("%sAvg", pattr);
+ attr.formatstr("%sAvg", pattr);
ad.Assign(attr.Value(), probe.Avg());
- attr.sprintf("%sMin", pattr);
+ attr.formatstr("%sMin", pattr);
ad.Assign(attr.Value(), probe.Min);
- attr.sprintf("%sMax", pattr);
+ attr.formatstr("%sMax", pattr);
ad.Assign(attr.Value(), probe.Max);
- attr.sprintf("%sStd", pattr);
+ attr.formatstr("%sStd", pattr);
ad.Assign(attr.Value(), probe.Std());
}
return ret;
@@ -435,25 +435,25 @@ template <> void stats_entry_recent<Probe>::Unpublish(ClassAd& ad, const char *
{
MyString attr;
ad.Delete(pattr);
- attr.sprintf("Recent%s", pattr);
+ attr.formatstr("Recent%s", pattr);
ad.Delete(attr.Value());
- attr.sprintf("Recent%sCount", pattr);
+ attr.formatstr("Recent%sCount", pattr);
ad.Delete(attr.Value());
ad.Delete(attr.Value()+6);
- attr.sprintf("Recent%sSum", pattr);
+ attr.formatstr("Recent%sSum", pattr);
ad.Delete(attr.Value());
ad.Delete(attr.Value()+6);
- attr.sprintf("Recent%sAvg", pattr);
+ attr.formatstr("Recent%sAvg", pattr);
ad.Delete(attr.Value());
ad.Delete(attr.Value()+6);
- attr.sprintf("Recent%sMin", pattr);
+ attr.formatstr("Recent%sMin", pattr);
ad.Delete(attr.Value());
ad.Delete(attr.Value()+6);
- attr.sprintf("Recent%sMax", pattr);
+ attr.formatstr("Recent%sMax", pattr);
ad.Delete(attr.Value());
ad.Delete(attr.Value()+6);
- attr.sprintf("Recent%sStd", pattr);
+ attr.formatstr("Recent%sStd", pattr);
ad.Delete(attr.Value());
ad.Delete(attr.Value()+6);
}
@@ -481,7 +481,7 @@ template <> void stats_entry_recent<Probe>::Publish(ClassAd& ad, const char * pa
if (flags & this->PubRecent) {
MyString attr(pattr);
if (flags & this->PubDecorateAttr) {
- attr.sprintf("Recent%s", pattr);
+ attr.formatstr("Recent%s", pattr);
}
ClassAdAssign(ad, attr.Value(), recent);
}
diff --git a/src/condor_utils/generic_stats.h b/src/condor_utils/generic_stats.h
index 53f36c7..6cc0b15 100644
--- a/src/condor_utils/generic_stats.h
+++ b/src/condor_utils/generic_stats.h
@@ -569,7 +569,7 @@ public:
void Unpublish(ClassAd & ad, const char * pattr) const {
ad.Delete(pattr);
MyString attr;
- attr.sprintf("Recent%s", pattr);
+ attr.formatstr("Recent%s", pattr);
ad.Delete(attr.Value());
};
@@ -694,7 +694,7 @@ public:
void Unpublish(ClassAd & ad, const char * pattr) const {
ad.Delete(pattr);
MyString attr;
- attr.sprintf("Recent%s", pattr);
+ attr.formatstr("Recent%s", pattr);
ad.Delete(attr.Value());
};
diff --git a/src/condor_utils/hashkey.cpp b/src/condor_utils/hashkey.cpp
index f25c712..c674b8b 100644
--- a/src/condor_utils/hashkey.cpp
+++ b/src/condor_utils/hashkey.cpp
@@ -33,9 +33,9 @@
void AdNameHashKey::sprint (MyString &s)
{
if (ip_addr.Length() )
- s.sprintf( "< %s , %s >", name.Value(), ip_addr.Value() );
+ s.formatstr( "< %s , %s >", name.Value(), ip_addr.Value() );
else
- s.sprintf( "< %s >", name.Value() );
+ s.formatstr( "< %s >", name.Value() );
}
bool operator== (const AdNameHashKey &lhs, const AdNameHashKey &rhs)
@@ -432,8 +432,8 @@ void
HashString::Build( const AdNameHashKey &hk )
{
if ( hk.ip_addr.Length() ) {
- sprintf( "< %s , %s >", hk.name.Value(), hk.ip_addr.Value() );
+ formatstr( "< %s , %s >", hk.name.Value(), hk.ip_addr.Value() );
} else {
- sprintf( "< %s >", hk.name.Value() );
+ formatstr( "< %s >", hk.name.Value() );
}
}
diff --git a/src/condor_utils/hibernator.tools.cpp b/src/condor_utils/hibernator.tools.cpp
index 8776c13..2b37496 100644
--- a/src/condor_utils/hibernator.tools.cpp
+++ b/src/condor_utils/hibernator.tools.cpp
@@ -130,7 +130,7 @@ void UserDefinedToolsHibernator::configure ()
"S1" );
/** Build the tool look-up parameter for the tool's path */
- name.sprintf (
+ name.formatstr (
"%s_USER_%s_TOOL",
"HIBERNATE",
"S1" );
@@ -145,7 +145,7 @@ void UserDefinedToolsHibernator::configure ()
/** Build the tool look-up parameter for the tool's
argument list */
- name.sprintf (
+ name.formatstr (
"%s_USER_%s_ARGS",
m_keyword.Value(),
description );
diff --git a/src/condor_utils/internet.cpp b/src/condor_utils/internet.cpp
index 9f728ad..563412c 100644
--- a/src/condor_utils/internet.cpp
+++ b/src/condor_utils/internet.cpp
@@ -1184,9 +1184,9 @@ int generate_sinful(char* buf, int len, const char* ip, int port) {
MyString generate_sinful(const char* ip, int port) {
MyString buf;
if (strchr(ip, ':')) {
- buf.sprintf("<[%s]:%d>", ip, port);
+ buf.formatstr("<[%s]:%d>", ip, port);
} else {
- buf.sprintf("<%s:%d>", ip, port);
+ buf.formatstr("<%s:%d>", ip, port);
}
return buf;
}
diff --git a/src/condor_utils/open_files_in_pid.cpp b/src/condor_utils/open_files_in_pid.cpp
index 9976d7c..6f5476f 100644
--- a/src/condor_utils/open_files_in_pid.cpp
+++ b/src/condor_utils/open_files_in_pid.cpp
@@ -24,7 +24,7 @@ set<MyString> open_files_in_pid(pid_t pid)
// Dig around in the proc file system looking for open files for the
// specified pid. This is Linux only, for now.
- tmp.sprintf("/proc/%lu/fd", (long unsigned) pid);
+ tmp.formatstr("/proc/%lu/fd", (long unsigned) pid);
Directory fds(tmp.Value());
// If a file is open multiple times, that's fine, we only record it once.
diff --git a/src/condor_utils/proc_family_proxy.cpp b/src/condor_utils/proc_family_proxy.cpp
index 4ffedb9..a148eac 100644
--- a/src/condor_utils/proc_family_proxy.cpp
+++ b/src/condor_utils/proc_family_proxy.cpp
@@ -490,7 +490,7 @@ ProcFamilyProxy::start_procd()
EXCEPT("GLEXEC_JOB is defined, but LIBEXEC not configured");
}
MyString glexec_kill;
- glexec_kill.sprintf("%s/condor_glexec_kill", libexec);
+ glexec_kill.formatstr("%s/condor_glexec_kill", libexec);
free(libexec);
args.AppendArg(glexec_kill.Value());
char* glexec = param("GLEXEC");
diff --git a/src/condor_utils/proc_id.cpp b/src/condor_utils/proc_id.cpp
index 86908c0..29c2115 100644
--- a/src/condor_utils/proc_id.cpp
+++ b/src/condor_utils/proc_id.cpp
@@ -125,7 +125,7 @@ procids_to_mystring(ExtArray<PROC_ID> *procids, MyString &str)
}
for(i = 0; i < procids->length(); i++) {
- tmp.sprintf("%d.%d", (*procids)[i].cluster, (*procids)[i].proc);
+ tmp.formatstr("%d.%d", (*procids)[i].cluster, (*procids)[i].proc);
str += tmp;
// don't put a comma on the last one.
if (i < (procids->length() - 1)) {
diff --git a/src/condor_utils/read_multiple_logs.cpp b/src/condor_utils/read_multiple_logs.cpp
index 45acfcf..c7fdeea 100644
--- a/src/condor_utils/read_multiple_logs.cpp
+++ b/src/condor_utils/read_multiple_logs.cpp
@@ -569,7 +569,7 @@ MultiLogFiles::readFile(char const *filename,std::string& buf)
int fd = safe_open_wrapper_follow(filename, O_RDONLY);
if (fd < 0) {
- rtnVal.sprintf("error opening submit file %s: %s",
+ rtnVal.formatstr("error opening submit file %s: %s",
filename, strerror(errno) );
dprintf(D_ALWAYS, "%s\n", rtnVal.Value() );
return rtnVal;
@@ -585,7 +585,7 @@ MultiLogFiles::readFile(char const *filename,std::string& buf)
break;
}
else {
- rtnVal.sprintf("failed to read submit file %s: %s",
+ rtnVal.formatstr("failed to read submit file %s: %s",
filename, strerror(errno) );
dprintf(D_ALWAYS, "%s\n", rtnVal.Value() );
close(fd);
@@ -648,7 +648,7 @@ MultiLogFiles::loadLogFileNamesFromStorkSubFile(
// reject empty log file names
if ( logfile.empty() ) {
unparser.Unparse( unparsed, &ad);
- rtnVal.sprintf("Stork job specifies null log file:%s",
+ rtnVal.formatstr("Stork job specifies null log file:%s",
unparsed.c_str() );
return rtnVal;
}
@@ -656,7 +656,7 @@ MultiLogFiles::loadLogFileNamesFromStorkSubFile(
// reject log file names with embedded macros
if ( logfile.find('$') != std::string::npos) {
unparser.Unparse( unparsed, &ad);
- rtnVal.sprintf("macros not allowed in Stork log file names:%s",
+ rtnVal.formatstr("macros not allowed in Stork log file names:%s",
unparsed.c_str() );
return rtnVal;
}
@@ -666,7 +666,7 @@ MultiLogFiles::loadLogFileNamesFromStorkSubFile(
if ( ! fullpath(logfile.c_str() ) ) {
MyString currentDir;
if ( ! condor_getcwd(currentDir) ) {
- rtnVal.sprintf("condor_getcwd() failed with errno %d (%s)",
+ rtnVal.formatstr("condor_getcwd() failed with errno %d (%s)",
errno, strerror(errno));
dprintf(D_ALWAYS, "ERROR: %s at %s:%d\n", rtnVal.Value(),
__FILE__, __LINE__);
@@ -979,7 +979,7 @@ GetFileID( const MyString &filename, MyString &fileID,
filename.Value() );
return false;
}
- fileID.sprintf( "%llu:%llu", (unsigned long long)swrap.GetBuf()->st_dev,
+ fileID.formatstr( "%llu:%llu", (unsigned long long)swrap.GetBuf()->st_dev,
(unsigned long long)swrap.GetBuf()->st_ino );
#endif
diff --git a/src/condor_utils/read_user_log_state.cpp b/src/condor_utils/read_user_log_state.cpp
index a3fa50f..9d3c970 100644
--- a/src/condor_utils/read_user_log_state.cpp
+++ b/src/condor_utils/read_user_log_state.cpp
@@ -762,7 +762,7 @@ ReadUserLogState::GetStateString( MyString &str, const char *label ) const
{
str = "";
if ( NULL != label ) {
- str.sprintf( "%s:\n", label );
+ str.formatstr( "%s:\n", label );
}
str.sprintf_cat (
" BasePath = %s\n"
@@ -788,7 +788,7 @@ ReadUserLogState::GetStateString(
const ReadUserLogFileState::FileState *istate;
if ( ( !convertState(state, istate) ) || ( !istate->m_version ) ) {
if ( label ) {
- str.sprintf( "%s: no state", label );
+ str.formatstr( "%s: no state", label );
}
else {
str = "no state\n";
@@ -798,7 +798,7 @@ ReadUserLogState::GetStateString(
str = "";
if ( NULL != label ) {
- str.sprintf( "%s:\n", label );
+ str.formatstr( "%s:\n", label );
}
str.sprintf_cat (
" signature = '%s'; version = %d; update = %ld\n"
diff --git a/src/condor_utils/socket_proxy.cpp b/src/condor_utils/socket_proxy.cpp
index 5ae1663..0f5e5e3 100644
--- a/src/condor_utils/socket_proxy.cpp
+++ b/src/condor_utils/socket_proxy.cpp
@@ -152,7 +152,7 @@ void SocketProxy::execute()
}
else if( n < 0 ) {
MyString error_msg;
- error_msg.sprintf("Error reading from socket %d: %s\n",
+ error_msg.formatstr("Error reading from socket %d: %s\n",
it->from_socket, strerror(errno));
setErrorMsg(error_msg.Value());
break;
diff --git a/src/condor_utils/user_job_policy.cpp b/src/condor_utils/user_job_policy.cpp
index 1fb0c0e..3736473 100644
--- a/src/condor_utils/user_job_policy.cpp
+++ b/src/condor_utils/user_job_policy.cpp
@@ -385,27 +385,27 @@ void UserPolicy::SetDefaults()
/* if the default user policy expressions do not exist, then add them
here and now with the usual defaults */
if (ph_expr == NULL) {
- buf.sprintf( "%s = FALSE", ATTR_PERIODIC_HOLD_CHECK );
+ buf.formatstr( "%s = FALSE", ATTR_PERIODIC_HOLD_CHECK );
m_ad->Insert( buf.Value() );
}
if (pr_expr == NULL) {
- buf.sprintf( "%s = FALSE", ATTR_PERIODIC_REMOVE_CHECK );
+ buf.formatstr( "%s = FALSE", ATTR_PERIODIC_REMOVE_CHECK );
m_ad->Insert( buf.Value() );
}
if (pl_expr == NULL) {
- buf.sprintf( "%s = FALSE", ATTR_PERIODIC_RELEASE_CHECK );
+ buf.formatstr( "%s = FALSE", ATTR_PERIODIC_RELEASE_CHECK );
m_ad->Insert( buf.Value() );
}
if (oeh_expr == NULL) {
- buf.sprintf( "%s = FALSE", ATTR_ON_EXIT_HOLD_CHECK );
+ buf.formatstr( "%s = FALSE", ATTR_ON_EXIT_HOLD_CHECK );
m_ad->Insert( buf.Value() );
}
if (oer_expr == NULL) {
- buf.sprintf( "%s = TRUE", ATTR_ON_EXIT_REMOVE_CHECK );
+ buf.formatstr( "%s = TRUE", ATTR_ON_EXIT_REMOVE_CHECK );
m_ad->Insert( buf.Value() );
}
}
@@ -703,7 +703,7 @@ bool UserPolicy::FiringReason(MyString &reason,int &reason_code,int &reason_subc
}
// Format up the reason string
- reason.sprintf( "The %s %s expression '%s' evaluated to ",
+ reason.formatstr( "The %s %s expression '%s' evaluated to ",
expr_src,
m_fire_expr,
exprString.Value());
diff --git a/src/condor_utils/user_log_header.cpp b/src/condor_utils/user_log_header.cpp
index 923ce07..6c4db81 100644
--- a/src/condor_utils/user_log_header.cpp
+++ b/src/condor_utils/user_log_header.cpp
@@ -196,7 +196,7 @@ UserLogHeader::dprint( int level, const char *label ) const
}
MyString buf;
- buf.sprintf( "%s header:", label );
+ buf.formatstr( "%s header:", label );
this->dprint( level, buf );
}
diff --git a/src/condor_utils/write_user_log.cpp b/src/condor_utils/write_user_log.cpp
index 13008c0..b7885d7 100644
--- a/src/condor_utils/write_user_log.cpp
+++ b/src/condor_utils/write_user_log.cpp
@@ -620,7 +620,7 @@ WriteUserLog::openGlobalLog( bool reopen, const UserLogHeader &header )
ret_val = writer.Write( *this );
MyString s;
- s.sprintf( "openGlobalLog: header: %s", m_global_path );
+ s.formatstr( "openGlobalLog: header: %s", m_global_path );
writer.dprint( D_FULLDEBUG, s );
// TODO: we should should add the number of events in the
@@ -784,7 +784,7 @@ WriteUserLog::checkGlobalLogRotation( void )
}
else {
MyString s;
- s.sprintf( "read %s header:", m_global_path );
+ s.formatstr( "read %s header:", m_global_path );
header_reader.dprint( D_FULLDEBUG, s );
}
@@ -836,7 +836,7 @@ WriteUserLog::checkGlobalLogRotation( void )
}
MyString s;
- s.sprintf( "checkGlobalLogRotation(): %s", m_global_path );
+ s.formatstr( "checkGlobalLogRotation(): %s", m_global_path );
header_writer.dprint( D_FULLDEBUG, s );
// And write the updated header
@@ -851,7 +851,7 @@ WriteUserLog::checkGlobalLogRotation( void )
fclose( header_fp );
MyString tmps;
- tmps.sprintf( "WriteUserLog: Wrote header to %s", m_global_path );
+ tmps.formatstr( "WriteUserLog: Wrote header to %s", m_global_path );
header_writer.dprint( D_FULLDEBUG, tmps );
}
if ( fake_lock ) {
diff --git a/src/condor_vm-gahp/vm_type.cpp b/src/condor_vm-gahp/vm_type.cpp
index 2b48fa0..eac7451 100644
--- a/src/condor_vm-gahp/vm_type.cpp
+++ b/src/condor_vm-gahp/vm_type.cpp
@@ -230,7 +230,7 @@ VMType::parseCommonParamFromClassAd(bool /* is_root false*/)
fclose(argfile_fp);
//??
- m_arg_file.sprintf("%s%c%s", m_workingpath.Value(),
+ m_arg_file.formatstr("%s%c%s", m_workingpath.Value(),
DIR_DELIM_CHAR, VM_UNIV_ARGUMENT_FILE);
}
@@ -346,7 +346,7 @@ bool
VMType::createTempFile(const char *template_string, const char *suffix, MyString &outname)
{
MyString tmp_config_name;
- tmp_config_name.sprintf("%s%c%s",m_workingpath.Value(),
+ tmp_config_name.formatstr("%s%c%s",m_workingpath.Value(),
DIR_DELIM_CHAR, template_string);
char *config_name = strdup(tmp_config_name.Value() );
@@ -366,7 +366,7 @@ VMType::createTempFile(const char *template_string, const char *suffix, MyString
outname = config_name;
if( suffix ) {
- tmp_config_name.sprintf("%s%s",config_name, suffix);
+ tmp_config_name.formatstr("%s%s",config_name, suffix);
if( rename(config_name, tmp_config_name.Value()) < 0 ) {
vmprintf(D_ALWAYS, "Cannot rename the temporary config file(%s), '%s' (errno %d) in "
@@ -397,7 +397,7 @@ VMType::isTransferedFile(const char* file_name, MyString& fullname)
&m_initial_working_files, true) ) {
// this file was transferred.
// make full path with workingdir
- tmp_fullname.sprintf("%s%c%s", m_workingpath.Value(),
+ tmp_fullname.formatstr("%s%c%s", m_workingpath.Value(),
DIR_DELIM_CHAR, condor_basename(file_name));
fullname = tmp_fullname;
return true;
diff --git a/src/condor_vm-gahp/vmgahp_common.cpp b/src/condor_vm-gahp/vmgahp_common.cpp
index 3b62a61..bfc151f 100644
--- a/src/condor_vm-gahp/vmgahp_common.cpp
+++ b/src/condor_vm-gahp/vmgahp_common.cpp
@@ -353,7 +353,7 @@ write_to_daemoncore_pipe(const char* fmt, ... )
MyString output;
va_list args;
va_start(args, fmt);
- output.vsprintf(fmt, args);
+ output.vformatstr(fmt, args);
write_to_daemoncore_pipe(vmgahp_stdout_pipe,
output.Value(), output.Length());
va_end(args);
diff --git a/src/condor_vm-gahp/vmware_type.cpp b/src/condor_vm-gahp/vmware_type.cpp
index 4c65d3d..8556bb0 100644
--- a/src/condor_vm-gahp/vmware_type.cpp
+++ b/src/condor_vm-gahp/vmware_type.cpp
@@ -127,10 +127,10 @@ change_monolithicSparse_snapshot_vmdk_file(const char* file, bool use_fullpath,
// parentfilename is not fullpath
if( dirpath[0] == '/' ) {
// submitted from Linux machine
- final_parentfilename.sprintf("%s/%s", dirpath, parentfilename.Value());
+ final_parentfilename.formatstr("%s/%s", dirpath, parentfilename.Value());
}else {
// submitted from Windows machine
- final_parentfilename.sprintf("%s\\%s", dirpath, parentfilename.Value());
+ final_parentfilename.formatstr("%s\\%s", dirpath, parentfilename.Value());
}
is_modified = true;
}
@@ -252,20 +252,20 @@ change_snapshot_vmdk_file(const char* file, bool use_fullpath, const char* dirpa
if( dirpath[0] == '/' ) {
// submitted from Linux machine
- tmp_fullname.sprintf("%s/%s", dirpath, value.Value());
+ tmp_fullname.formatstr("%s/%s", dirpath, value.Value());
}else {
// submitted from Windows machine
- tmp_fullname.sprintf("%s\\%s", dirpath, value.Value());
+ tmp_fullname.formatstr("%s\\%s", dirpath, value.Value());
}
- tmp_line.sprintf("%s=\"%s\"\n", name.Value(), tmp_fullname.Value());
+ tmp_line.formatstr("%s=\"%s\"\n", name.Value(), tmp_fullname.Value());
filelines.append(tmp_line.Value());
is_modified = true;
continue;
}
}else {
if( fullpath(value.Value()) ) {
- tmp_line.sprintf("%s=\"%s\"\n", name.Value(), condor_basename(value.Value()));
+ tmp_line.formatstr("%s=\"%s\"\n", name.Value(), condor_basename(value.Value()));
filelines.append(tmp_line.Value());
is_modified = true;
continue;
@@ -359,13 +359,13 @@ static void change_snapshot_vmsd_file(const char *file, StringList *parent_filen
if( dirpath[0] == '/' ) {
// submitted from Linux machine
- tmp_fullname.sprintf("%s/%s", dirpath, value.Value());
+ tmp_fullname.formatstr("%s/%s", dirpath, value.Value());
}else {
// submitted from Windows machine
- tmp_fullname.sprintf("%s\\%s", dirpath, value.Value());
+ tmp_fullname.formatstr("%s\\%s", dirpath, value.Value());
}
- tmp_line.sprintf("%s = \"%s\"\n", name.Value(),
+ tmp_line.formatstr("%s = \"%s\"\n", name.Value(),
tmp_fullname.Value());
filelines.append(tmp_line.Value());
is_modified = true;
@@ -373,7 +373,7 @@ static void change_snapshot_vmsd_file(const char *file, StringList *parent_filen
}
}else {
if( fullpath(value.Value()) ) {
- tmp_line.sprintf("%s = \"%s\"\n", name.Value(),
+ tmp_line.formatstr("%s = \"%s\"\n", name.Value(),
condor_basename(value.Value()));
filelines.append(tmp_line.Value());
is_modified = true;
@@ -648,7 +648,7 @@ VMwareType::adjustCkptConfig(const char* vmconfig)
tmp_string2 = m_vm_networking_type;
tmp_string2.upper_case();
- tmp_string.sprintf("VMWARE_%s_NETWORKING_TYPE", tmp_string2.Value());
+ tmp_string.formatstr("VMWARE_%s_NETWORKING_TYPE", tmp_string2.Value());
char *net_type = param(tmp_string.Value());
if( net_type ) {
@@ -665,7 +665,7 @@ VMwareType::adjustCkptConfig(const char* vmconfig)
}
}
- tmp_line.sprintf("ethernet0.connectionType = \"%s\"",
+ tmp_line.formatstr("ethernet0.connectionType = \"%s\"",
networking_type.Value());
configVars.append(tmp_line.Value());
continue;
@@ -834,7 +834,7 @@ VMwareType::readVMXfile(const char *filename, const char *dirpath)
// file is transferred
if( fullpath(value.Value()) ) {
// we use basename instead of fullname
- tmp_line.sprintf("%s = \"%s\"", name.Value(),
+ tmp_line.formatstr("%s = \"%s\"", name.Value(),
tmp_base_name );
m_configVars.append(tmp_line.Value());
}else {
@@ -854,10 +854,10 @@ VMwareType::readVMXfile(const char *filename, const char *dirpath)
}else {
// we create fullname with given dirpath
MyString tmp_fullname;
- tmp_fullname.sprintf("%s%c%s", dirpath,
+ tmp_fullname.formatstr("%s%c%s", dirpath,
DIR_DELIM_CHAR, tmp_base_name);
- tmp_line.sprintf("%s = \"%s\"", name.Value(),
+ tmp_line.formatstr("%s = \"%s\"", name.Value(),
tmp_fullname.Value());
if( !(*dirpath) || check_vm_read_access_file(tmp_fullname.Value())
@@ -876,7 +876,7 @@ VMwareType::readVMXfile(const char *filename, const char *dirpath)
pos = tmp_name.FindChar('.', 0);
if( pos > 0 ) {
tmp_name.setChar(pos, '\0');
- tmp_line.sprintf("%s.writeThrough = \"TRUE\"", tmp_name.Value());
+ tmp_line.formatstr("%s.writeThrough = \"TRUE\"", tmp_name.Value());
m_configVars.append(tmp_line.Value());
}
@@ -1774,7 +1774,7 @@ VMwareType::CreateConfigFile()
// Read transferred vmx file
MyString ori_vmx_file;
- ori_vmx_file.sprintf("%s%c%s",m_workingpath.Value(),
+ ori_vmx_file.formatstr("%s%c%s",m_workingpath.Value(),
DIR_DELIM_CHAR, m_vmware_vmx.Value());
if( readVMXfile(ori_vmx_file.Value(), m_vmware_dir.Value())
@@ -1785,11 +1785,11 @@ VMwareType::CreateConfigFile()
// Add memsize to m_configVars
MyString tmp_line;
- tmp_line.sprintf("memsize = \"%d\"", m_vm_mem);
+ tmp_line.formatstr("memsize = \"%d\"", m_vm_mem);
m_configVars.append(tmp_line.Value());
// Add displyName to m_configVars
- tmp_line.sprintf("displayName = \"%s\"", m_vm_name.Value());
+ tmp_line.formatstr("displayName = \"%s\"", m_vm_name.Value());
m_configVars.append(tmp_line.Value());
// Add networking parameters to m_configVars
@@ -1801,7 +1801,7 @@ VMwareType::CreateConfigFile()
tmp_string2 = m_vm_networking_type;
tmp_string2.upper_case();
- tmp_string.sprintf("VMWARE_%s_NETWORKING_TYPE", tmp_string2.Value());
+ tmp_string.formatstr("VMWARE_%s_NETWORKING_TYPE", tmp_string2.Value());
char *net_type = param(tmp_string.Value());
if( net_type ) {
@@ -1819,14 +1819,14 @@ VMwareType::CreateConfigFile()
}
m_configVars.append("ethernet0.present = \"TRUE\"");
- tmp_line.sprintf("ethernet0.connectionType = \"%s\"",
+ tmp_line.formatstr("ethernet0.connectionType = \"%s\"",
networking_type.Value());
m_configVars.append(tmp_line.Value());
if (!m_vm_job_mac.IsEmpty())
{
vmprintf(D_FULLDEBUG, "mac address is %s\n", m_vm_job_mac.Value());
m_configVars.append("ethernet0.addressType = \"static\"");
- tmp_line.sprintf("ethernet0.address = \"%s\"", m_vm_job_mac.Value());
+ tmp_line.formatstr("ethernet0.address = \"%s\"", m_vm_job_mac.Value());
m_configVars.append(tmp_line.Value());
//**********************************************************************
// LIMITATION: the mac address has to be in the range
diff --git a/src/condor_vm-gahp/xen_type.linux.cpp b/src/condor_vm-gahp/xen_type.linux.cpp
index 8a96eef..d827b99 100644
--- a/src/condor_vm-gahp/xen_type.linux.cpp
+++ b/src/condor_vm-gahp/xen_type.linux.cpp
@@ -207,7 +207,7 @@ VirshType::Shutdown()
// delete the checkpoint timestamp file
MyString tmpfilename;
- tmpfilename.sprintf("%s%c%s", m_workingpath.Value(),
+ tmpfilename.formatstr("%s%c%s", m_workingpath.Value(),
DIR_DELIM_CHAR, XEN_CKPT_TIMESTAMP_FILE);
unlink(tmpfilename.Value());
@@ -1272,7 +1272,7 @@ XenType::killVMFast(const char* vmname)
void
VirshType::makeNameofSuspendfile(MyString& name)
{
- name.sprintf("%s%c%s", m_workingpath.Value(), DIR_DELIM_CHAR,
+ name.formatstr("%s%c%s", m_workingpath.Value(), DIR_DELIM_CHAR,
XEN_MEM_SAVED_FILE);
}
@@ -1364,7 +1364,7 @@ VirshType::findCkptConfigAndSuspendFile(MyString &vmconfig, MyString &suspendfil
if( filelist_contains_file( XEN_CONFIG_FILE_NAME,
&m_transfer_intermediate_files, true) ) {
// There is a vm config file for checkpointed files
- tmpconfig.sprintf("%s%c%s",m_workingpath.Value(),
+ tmpconfig.formatstr("%s%c%s",m_workingpath.Value(),
DIR_DELIM_CHAR, XEN_CONFIG_FILE_NAME);
}
@@ -1626,7 +1626,7 @@ bool XenType::CreateConfigFile()
// create a vm config file
MyString tmp_config_name;
- tmp_config_name.sprintf("%s%c%s",m_workingpath.Value(),
+ tmp_config_name.formatstr("%s%c%s",m_workingpath.Value(),
DIR_DELIM_CHAR, XEN_CONFIG_FILE_NAME);
vmprintf(D_ALWAYS, "CreateXenVMConfigFile\n");
@@ -1735,7 +1735,7 @@ KVMType::CreateConfigFile()
// create a vm config file
MyString tmp_config_name;
- tmp_config_name.sprintf("%s%c%s",m_workingpath.Value(),
+ tmp_config_name.formatstr("%s%c%s",m_workingpath.Value(),
DIR_DELIM_CHAR, XEN_CONFIG_FILE_NAME);
vmprintf(D_ALWAYS, "CreateKvmVMConfigFile\n");
diff --git a/src/condor_who/who.cpp b/src/condor_who/who.cpp
index 8fc2df6..5085937 100644
--- a/src/condor_who/who.cpp
+++ b/src/condor_who/who.cpp
@@ -512,7 +512,7 @@ void parse_args(int /*argc*/, char *argv[])
opts = FormatOptionAutoWidth | FormatOptionNoTruncate;
App.print_head.Append(hd);
}
- else if (flabel) { lbl.sprintf("%s = ", argv[ixArg]); wid = 0; opts = 0; }
+ else if (flabel) { lbl.formatstr("%s = ", argv[ixArg]); wid = 0; opts = 0; }
lbl += fCapV ? "%V" : "%v";
if (App.diagnostic) {
--
1.7.7.6
>From 736dccb815fc38b5da9feb1c665475a1ad6ba4ee Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@xxxxxxxxxx>
Date: Fri, 3 Aug 2012 15:10:45 +0200
Subject: [PATCH 9/9] Remove sprintf() and vsprintf() methods from MyString
---
src/condor_utils/MyString.cpp | 22 ----------------------
src/condor_utils/MyString.h | 2 --
2 files changed, 0 insertions(+), 24 deletions(-)
diff --git a/src/condor_utils/MyString.cpp b/src/condor_utils/MyString.cpp
index ac3db2e..bcffd85 100644
--- a/src/condor_utils/MyString.cpp
+++ b/src/condor_utils/MyString.cpp
@@ -617,28 +617,6 @@ MyString::formatstr(const char *format,...)
return succeeded;
}
-bool
-MyString::vsprintf(const char *format,va_list args)
-{
- Len = 0;
- if(Data) Data[0] = '\0';
- return vsprintf_cat(format,args);
-}
-
-bool
-MyString::sprintf(const char *format,...)
-{
- bool succeeded;
- va_list args;
-
- va_start(args, format);
- succeeded = vformatstr(format,args);
- va_end(args);
-
- return succeeded;
-}
-
-
void
MyString::lower_case(void)
{
diff --git a/src/condor_utils/MyString.h b/src/condor_utils/MyString.h
index b306284..867cda8 100644
--- a/src/condor_utils/MyString.h
+++ b/src/condor_utils/MyString.h
@@ -241,14 +241,12 @@ class MyString
* The returns true if it succeeded, false otherwise.
*/
bool formatstr(const char *format, ...) CHECK_PRINTF_FORMAT(2,3);
- bool sprintf(const char *format, ...) CHECK_PRINTF_FORMAT(2,3);
/** Fills a MyString with what you would have gotten from vsprintf.
* This is handy if you define your own printf-like functions.
*/
bool vformatstr(const char *format, va_list args);
- bool vsprintf(const char *format, va_list args);
/** Like sprintf, but this appends to existing data. */
bool sprintf_cat(const char *format, ...) CHECK_PRINTF_FORMAT(2,3);
--
1.7.7.6