Skip to content

Commit 020a974

Browse files
committed
BF: CS-682 qacct returns error state != 0 in common non-error scenario
1 parent 6b14ecd commit 020a974

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

source/clients/qacct/ocs_qacct.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ int main(int argc, char *argv[]);
172172
*/
173173
int main(int argc, char **argv)
174174
{
175+
int ret = 0;
175176
u_long32 days;
176177
sge_qacct_columns column_sizes;
177178
int beginflag=0;
@@ -538,7 +539,7 @@ int main(int argc, char **argv)
538539
acct_file = bootstrap_get_acct_file();
539540
if (!std::filesystem::exists(acct_file)) {
540541
printf("%s\n", MSG_HISTORY_NOJOBSRUNNINGSINCESTARTUP);
541-
goto QACCT_EXIT;
542+
goto QACCT_EXIT_BUT_NO_ERROR;
542543
}
543544
}
544545
} else {
@@ -690,6 +691,8 @@ int main(int argc, char **argv)
690691
if (fp == nullptr) {
691692
ERROR(MSG_HISTORY_ERRORUNABLETOOPENX_S ,acct_file);
692693
printf("%s\n", MSG_HISTORY_NOJOBSRUNNINGSINCESTARTUP);
694+
695+
// file exists but cannot be opened -> error
693696
goto QACCT_EXIT;
694697
}
695698

@@ -1125,14 +1128,16 @@ int main(int argc, char **argv)
11251128
FCLOSE_ERROR:
11261129
ERROR(MSG_FILE_ERRORCLOSEINGXY_SS, acct_file, strerror(errno));
11271130
QACCT_EXIT:
1131+
ret = 1;
1132+
QACCT_EXIT_BUT_NO_ERROR:
11281133
sge_prof_cleanup();
11291134
lFreeList(&sorted_list);
11301135
lFreeSortOrder(&sort_order);
11311136
sge_free(&(options.group));
11321137
sge_free(&(options.host));
11331138
free_qacct_lists(&centry_list, &queue_list, &exechost_list, &hgrp_list);
1134-
sge_exit(1);
1135-
DRETURN(1);
1139+
sge_exit(ret);
1140+
DRETURN(ret);
11361141
}
11371142

11381143
static void print_full_ulong(int full_length, u_long32 value) {

0 commit comments

Comments
 (0)