summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-11 19:33:48 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-10-13 17:56:54 -0400
commit51d122af23533b0b8318911c4fc8b128ad8eafb7 (patch)
tree1690a73e00c06ac56bb8ff405ea28aa1dd600099 /src/core/manager.c
parenta3e7f417d72ba3251fd6b3a228a2721a4b725a03 (diff)
Introduce _cleanup_fdset_free_
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 58dacdc8b5..b45a2e11a5 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -236,7 +236,7 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
*p++ = '*';
if (pos < width-1)
p = mempset(p, ' ', width-1-pos);
- p = stpcpy(p, ANSI_HIGHLIGHT_OFF);
+ strcpy(p, ANSI_HIGHLIGHT_OFF);
}
}
@@ -257,6 +257,7 @@ static void manager_print_jobs_in_progress(Manager *m) {
/* m->n_running_jobs must be consistent with the contents of m->jobs,
* so the above loop must have succeeded in finding j. */
assert(counter == print_nr + 1);
+ assert(j);
cylon_pos = m->jobs_in_progress_iteration % 14;
if (cylon_pos >= 8)
@@ -2317,8 +2318,8 @@ int manager_distribute_fds(Manager *m, FDSet *fds) {
int manager_reload(Manager *m) {
int r, q;
- FILE *f;
- FDSet *fds;
+ _cleanup_fclose_ FILE *f = NULL;
+ _cleanup_fdset_free_ FDSet *fds = NULL;
assert(m);
@@ -2332,20 +2333,18 @@ int manager_reload(Manager *m) {
fds = fdset_new();
if (!fds) {
m->n_reloading --;
- r = -ENOMEM;
- goto finish;
+ return -ENOMEM;
}
r = manager_serialize(m, f, fds, false);
if (r < 0) {
m->n_reloading --;
- goto finish;
+ return r;
}
if (fseeko(f, 0, SEEK_SET) < 0) {
m->n_reloading --;
- r = -errno;
- goto finish;
+ return -errno;
}
/* From here on there is no way back. */
@@ -2389,13 +2388,6 @@ int manager_reload(Manager *m) {
m->send_reloading_done = true;
-finish:
- if (f)
- fclose(f);
-
- if (fds)
- fdset_free(fds);
-
return r;
}