If user's bash does not have bultin stat, updating image perms was terribly slow. This patch adds a simple c program that does the job without exec overhead