perf map: Tighten snprintf() string precision to pass gcc check on some 32-bit arches
[linux-2.6-microblaze.git] / tools / perf / util / map.c
index f44ede4..fbc40a2 100644 (file)
@@ -77,8 +77,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
        if (strstarts(filename, "/system/lib/")) {
                char *ndk, *app;
                const char *arch;
-               size_t ndk_length;
-               size_t app_length;
+               int ndk_length, app_length;
 
                ndk = getenv("NDK_ROOT");
                app = getenv("APP_PLATFORM");
@@ -106,8 +105,8 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
                if (new_length > PATH_MAX)
                        return false;
                snprintf(newfilename, new_length,
-                       "%s/platforms/%s/arch-%s/usr/lib/%s",
-                       ndk, app, arch, libname);
+                       "%.*s/platforms/%.*s/arch-%s/usr/lib/%s",
+                       ndk_length, ndk, app_length, app, arch, libname);
 
                return true;
        }
@@ -130,8 +129,8 @@ void map__init(struct map *map, u64 start, u64 end, u64 pgoff, struct dso *dso)
 
 struct map *map__new(struct machine *machine, u64 start, u64 len,
                     u64 pgoff, struct dso_id *id,
-                    u32 prot, u32 flags, char *filename,
-                    struct thread *thread)
+                    u32 prot, u32 flags, struct build_id *bid,
+                    char *filename, struct thread *thread)
 {
        struct map *map = malloc(sizeof(*map));
        struct nsinfo *nsi = NULL;
@@ -194,6 +193,10 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
                                dso__set_loaded(dso);
                }
                dso->nsinfo = nsi;
+
+               if (build_id__is_defined(bid))
+                       dso__set_build_id(dso, bid);
+
                dso__put(dso);
        }
        return map;