Merge tag 'u-boot-amlogic-20181207' of git://git.denx.de/u-boot-amlogic
[platform/kernel/u-boot.git] / arch / sandbox / cpu / os.c
index aa92694..a8d01e4 100644 (file)
@@ -668,7 +668,7 @@ static int os_jump_to_file(const char *fname)
        os_free(argv);
        if (err) {
                perror("Unable to run image");
-               printf("Image filename '%s'\n", mem_fname);
+               printf("Image filename '%s'\n", fname);
                return err;
        }
 
@@ -735,9 +735,10 @@ int os_find_u_boot(char *fname, int maxlen)
        }
 
        /* Look for 'u-boot' in the parent directory of spl/ */
-       p = strstr(fname, "/spl/");
+       p = strstr(fname, "spl/");
        if (p) {
-               strcpy(p, p + 4);
+               /* Remove the "spl" characters */
+               memmove(p, p + 4, strlen(p + 4) + 1);
                fd = os_open(fname, O_RDONLY);
                if (fd >= 0) {
                        close(fd);