Skip to content

Commit fe8563f

Browse files
Michael RungeAndroid Git Automerger
authored andcommitted
am 5ddf429: Log mount/unmount errors to UI
* commit '5ddf4293df45a051c7900eeb62fb5ec4950b6cb6': Log mount/unmount errors to UI
2 parents 915d661 + 5ddf429 commit fe8563f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

updater/install.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
151151
const MtdPartition* mtd;
152152
mtd = mtd_find_partition_by_name(location);
153153
if (mtd == NULL) {
154-
printf("%s: no mtd partition named \"%s\"",
154+
uiPrintf(state, "%s: no mtd partition named \"%s\"",
155155
name, location);
156156
result = strdup("");
157157
goto done;
158158
}
159159
if (mtd_mount_partition(mtd, mount_point, fs_type, 0 /* rw */) != 0) {
160-
printf("mtd mount of %s failed: %s\n",
160+
uiPrintf(state, "mtd mount of %s failed: %s\n",
161161
location, strerror(errno));
162162
result = strdup("");
163163
goto done;
@@ -167,7 +167,7 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
167167
if (mount(location, mount_point, fs_type,
168168
MS_NOATIME | MS_NODEV | MS_NODIRATIME,
169169
has_mount_options ? mount_options : "") < 0) {
170-
printf("%s: failed to mount %s at %s: %s\n",
170+
uiPrintf(state, "%s: failed to mount %s at %s: %s\n",
171171
name, location, mount_point, strerror(errno));
172172
result = strdup("");
173173
} else {
@@ -231,10 +231,14 @@ Value* UnmountFn(const char* name, State* state, int argc, Expr* argv[]) {
231231
scan_mounted_volumes();
232232
const MountedVolume* vol = find_mounted_volume_by_mount_point(mount_point);
233233
if (vol == NULL) {
234-
printf("unmount of %s failed; no such volume\n", mount_point);
234+
uiPrintf(state, "unmount of %s failed; no such volume\n", mount_point);
235235
result = strdup("");
236236
} else {
237-
unmount_mounted_volume(vol);
237+
int ret = unmount_mounted_volume(vol);
238+
if (ret != 0) {
239+
uiPrintf(state, "unmount of %s failed (%d): %s\n",
240+
mount_point, ret, strerror(errno));
241+
}
238242
result = mount_point;
239243
}
240244

0 commit comments

Comments
 (0)