#include "actions.h"
char *
-do_checksum (char *csumtype, char *path)
+do_checksum (const char *csumtype, const char *path)
{
const char *program;
char *buf;
char *out, *err;
- int r, len;
-
- NEED_ROOT (NULL);
- ABS_PATH (path, NULL);
+ int r;
+ int len;
if (strcasecmp (csumtype, "crc") == 0)
program = "cksum";
}
/* Make the path relative to /sysroot. */
- len = strlen (path) + 9;
- buf = malloc (len);
+ buf = sysroot_path (path);
if (!buf) {
reply_with_perror ("malloc");
return NULL;
}
- snprintf (buf, len, "/sysroot%s", path);
r = command (&out, &err, program, buf, NULL);
free (buf);