rc = snprintf(cmd, sizeof(cmd), "rm -rf -- '%s'", mainpath);
ASSERTF(rc > 0 && rc < sizeof(cmd),
"invalid delete command for path '%s'", mainpath);
- system(cmd);
+ rc = system(cmd);
+ ASSERTF(rc != -1, "Cannot execute rm command");
+ ASSERTF(WEXITSTATUS(rc) == 0,
+ "rm command returned %d", WEXITSTATUS(rc));
}
/* Helper - call path2fid, fd2fid and fid2path against an existing
static char qword_buf[8192];
static char tmp_buf[8192];
-void qword_print(FILE *f, char *str)
+int qword_print(FILE *f, char *str)
{
char *bp = qword_buf;
int len = sizeof(qword_buf);
+ size_t sret;
+
qword_add(&bp, &len, str);
- fwrite(qword_buf, bp-qword_buf, 1, f);
+ sret = fwrite(qword_buf, bp-qword_buf, 1, f);
/* XXX: */
memcpy(tmp_buf, qword_buf, bp-qword_buf);
tmp_buf[bp-qword_buf] = '\0';
printerr(2, "%s", tmp_buf);
+
+ return sret != 1;
}
-void qword_printhex(FILE *f, char *str, int slen)
+int qword_printhex(FILE *f, char *str, int slen)
{
char *bp = qword_buf;
int len = sizeof(qword_buf);
+ size_t sret;
+
qword_addhex(&bp, &len, str, slen);
- fwrite(qword_buf, bp-qword_buf, 1, f);
+ sret = fwrite(qword_buf, bp-qword_buf, 1, f);
/* XXX: */
memcpy(tmp_buf, qword_buf, bp-qword_buf);
tmp_buf[bp-qword_buf] = '\0';
printerr(2, "%s", tmp_buf);
+
+ return sret != 1;
}
void qword_printint(FILE *f, int num)
void qword_addint(char **bpp, int *lp, int n);
void qword_adduint(char **bpp, int *lp, unsigned int n);
void qword_addeol(char **bpp, int *lp);
-void qword_print(FILE *f, char *str);
-void qword_printhex(FILE *f, char *str, int slen);
+int qword_print(FILE *f, char *str);
+int qword_printhex(FILE *f, char *str, int slen);
void qword_printint(FILE *f, int num);
int qword_eol(FILE *f);
int readline(int fd, char **buf, int *lenp);