lineedit: do not hang on error, but return error indicator.
[oweals/busybox.git] / util-linux / readprofile.c
index 1c157120dbe943187bb1b57728982d11998d0f43..00b3382d850a77626df0bc1c4b28085509ac1945 100644 (file)
@@ -4,7 +4,7 @@
  *
  *  Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it)
  *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
 /*
@@ -144,7 +144,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
 
        total = 0;
 
-       map = xfopen(mapFile, "r");
+       map = xfopen_for_read(mapFile);
 
        while (fgets(mapline, S_LEN, map)) {
                if (sscanf(mapline, "%llx %s %s", &fn_add, mode, fn_name) != 3)
@@ -176,9 +176,11 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
                /* ignore any LEADING (before a '[tT]' symbol is found)
                   Absolute symbols */
                if ((*mode == 'A' || *mode == '?') && total == 0) continue;
-               if (*mode != 'T' && *mode != 't' &&
-                   *mode != 'W' && *mode != 'w')
+               if (*mode != 'T' && *mode != 't'
+                && *mode != 'W' && *mode != 'w'
+               ) {
                        break;  /* only text is profiled */
+               }
 
                if (indx >= len / sizeof(*buf))
                        bb_error_msg_and_die("profile address out of range. "