Signed-off-by: Karel Zak <kzak@redhat.com>
{
char *content; /* Stuff to write to disk file */
FILE *fp;
+ int rc = EXIT_FAILURE;
xasprintf(&content, "%f %"PRId64" %f\n%"PRId64"\n%s\n",
adjtime->drift_factor,
fp = fopen(ctl->adj_file_name, "w");
if (fp == NULL) {
warn(_("cannot open %s"), ctl->adj_file_name);
- free(content);
- return EXIT_FAILURE;
+ goto done;
}
rc = fputs(content, fp) < 0;
if (rc) {
warn(_("cannot update %s"), ctl->adj_file_name);
- free(content);
- return EXIT_FAILURE;
+ goto done;
}
}
+
+ rc = EXIT_SUCCESS;
+done:
free(content);
- return EXIT_SUCCESS;
+ return rc;
}
/*