Skip to content

Commit

Permalink
various minors
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Nov 27, 2020
1 parent 2150ca3 commit 91333d7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ static char *get_output_file(int *pid) {
error("Error in get_output_file line size");
fprintf(stderr, "Error in the request: %s",
string);
free(string);
exit(-1);
/* WILL NOT GO FURTHER */
default:
Expand Down Expand Up @@ -487,6 +488,7 @@ void c_remove_job() {
res = recv_bytes(server_socket, string, m.u.size);
fprintf(stderr, "Error in the request: %s",
string);
free(string);
exit(-1);
/* WILL NOT GO FURTHER */
default:
Expand Down Expand Up @@ -515,6 +517,7 @@ int c_wait_job_recv() {
error("Error in wait_job - line size");
fprintf(stderr, "Error in the request: %s",
string);
free(string);
exit(-1);
/* WILL NOT GO FURTHER */
default:
Expand Down Expand Up @@ -610,6 +613,7 @@ void c_move_urgent() {
error("Error in move_urgent - line size");
fprintf(stderr, "Error in the request: %s",
string);
free(string);
exit(-1);
/* WILL NOT GO FURTHER */
default:
Expand Down Expand Up @@ -645,6 +649,7 @@ void c_get_state() {
error("Error in get_state - line size");
fprintf(stderr, "Error in the request: %s",
string);
free(string);
exit(-1);
/* WILL NOT GO FURTHER */
default:
Expand Down Expand Up @@ -680,6 +685,7 @@ void c_swap_jobs() {
error("Error in swap_jobs - line size");
fprintf(stderr, "Error in the request: %s",
string);
free(string);
exit(-1);
/* WILL NOT GO FURTHER */
default:
Expand Down Expand Up @@ -737,6 +743,7 @@ void c_show_label() {
error("Error in get_label - line size");

printf("%s", string);
free(string);
return;
default:
warning("Wrong internal message in get_label");
Expand Down
4 changes: 3 additions & 1 deletion jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ int s_count_allocating_jobs() {
return count;
}

void s_get_label(int s, int jobid) {
void s_send_label(int s, int jobid) {
struct Job *p = 0;
char *label;

Expand Down Expand Up @@ -250,6 +250,8 @@ void s_get_label(int s, int jobid) {
} else
label = "";
send_list_line(s, label);
if (p->label)
free(label);
}

void s_send_cmd(int s, int jobid) {
Expand Down
2 changes: 1 addition & 1 deletion main.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ int job_is_holding_client(int jobid);

int wake_hold_client();

void s_get_label(int s, int jobid);
void s_send_label(int s, int jobid);

void s_kill_all_jobs(int s);

Expand Down
2 changes: 1 addition & 1 deletion server.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ client_read(int index) {
s_send_last_id(s);
break;
case GET_LABEL:
s_get_label(s, m.u.jobid);
s_send_label(s, m.u.jobid);
break;
case GET_CMD:
s_send_cmd(s, m.u.jobid);
Expand Down

0 comments on commit 91333d7

Please sign in to comment.