Do some cleanups (like freeing memory and closing file descriptors) before
leaving the functions.
This commit is contained in:
parent
71aec6d082
commit
e6d0ea1022
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169193
@ -1053,7 +1053,7 @@ eli_backup(struct gctl_req *req)
|
|||||||
}
|
}
|
||||||
if (provfd == -1) {
|
if (provfd == -1) {
|
||||||
gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno));
|
gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno));
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
filefd = open(file, O_WRONLY | O_TRUNC | O_CREAT, 0600);
|
filefd = open(file, O_WRONLY | O_TRUNC | O_CREAT, 0600);
|
||||||
if (filefd == -1) {
|
if (filefd == -1) {
|
||||||
@ -1066,13 +1066,13 @@ eli_backup(struct gctl_req *req)
|
|||||||
if (mediasize == 0 || secsize == 0) {
|
if (mediasize == 0 || secsize == 0) {
|
||||||
gctl_error(req, "Cannot get informations about %s: %s.", prov,
|
gctl_error(req, "Cannot get informations about %s: %s.", prov,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
sector = malloc(secsize);
|
sector = malloc(secsize);
|
||||||
if (sector == NULL) {
|
if (sector == NULL) {
|
||||||
gctl_error(req, "Cannot allocate memory.");
|
gctl_error(req, "Cannot allocate memory.");
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read metadata from the provider. */
|
/* Read metadata from the provider. */
|
||||||
@ -1139,7 +1139,7 @@ eli_restore(struct gctl_req *req)
|
|||||||
}
|
}
|
||||||
if (provfd == -1) {
|
if (provfd == -1) {
|
||||||
gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno));
|
gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno));
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
mediasize = g_get_mediasize(prov);
|
mediasize = g_get_mediasize(prov);
|
||||||
@ -1147,13 +1147,13 @@ eli_restore(struct gctl_req *req)
|
|||||||
if (mediasize == 0 || secsize == 0) {
|
if (mediasize == 0 || secsize == 0) {
|
||||||
gctl_error(req, "Cannot get informations about %s: %s.", prov,
|
gctl_error(req, "Cannot get informations about %s: %s.", prov,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
sector = malloc(secsize);
|
sector = malloc(secsize);
|
||||||
if (sector == NULL) {
|
if (sector == NULL) {
|
||||||
gctl_error(req, "Cannot allocate memory.");
|
gctl_error(req, "Cannot allocate memory.");
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read metadata from the backup file. */
|
/* Read metadata from the backup file. */
|
||||||
|
Loading…
Reference in New Issue
Block a user