Skip to content

Commit

Permalink
oui-io-util: Drop sha256 checksum
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
  • Loading branch information
Jianhui Zhao committed Jul 2, 2019
1 parent 04a2ef9 commit c7131d5
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions oui-io-util/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ session_access(const char *sid, const char *obj, const char *func)
}

static char *
checksum(const char *applet, size_t sumlen, const char *file)
md5sum(const char *file)
{
pid_t pid;
int fds[2];
Expand All @@ -141,14 +141,14 @@ checksum(const char *applet, size_t sumlen, const char *file)
close(fds[0]);
close(fds[1]);

if (execl("/bin/busybox", "/bin/busybox", applet, file, NULL))
if (execl("/bin/busybox", "/bin/busybox", "md5sum", file, NULL))
return NULL;

break;

default:
memset(chksum, 0, sizeof(chksum));
read(fds[0], chksum, sumlen);
read(fds[0], chksum, 32);
waitpid(pid, NULL, 0);
close(fds[0]);
close(fds[1]);
Expand Down Expand Up @@ -279,14 +279,8 @@ response(bool success, const char *message)
else
printf("\t\"size\": null,\n");
chksum = checksum("md5sum", 32, st.filename);
printf("\t\"checksum\": %s%s%s,\n",
chksum ? "\"" : "",
chksum ? chksum : "null",
chksum ? "\"" : "");
chksum = checksum("sha256sum", 64, st.filename);
printf("\t\"sha256sum\": %s%s%s\n",
chksum = md5sum(st.filename);
printf("\t\"checksum\": %s%s%s\n",
chksum ? "\"" : "",
chksum ? chksum : "null",
chksum ? "\"" : "");
Expand Down

0 comments on commit c7131d5

Please sign in to comment.