aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/triplet.c23
-rw-r--r--src/wydawca.c7
2 files changed, 18 insertions, 12 deletions
diff --git a/src/triplet.c b/src/triplet.c
index 9f051db..bfd58e5 100644
--- a/src/triplet.c
+++ b/src/triplet.c
@@ -343,9 +343,8 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
343 char timebuf[sizeof "YYYY-MM-DD HH:MM:SS +0000"]; 343 char timebuf[sizeof "YYYY-MM-DD HH:MM:SS +0000"];
344 struct passwd *pw; 344 struct passwd *pw;
345 struct group *grp; 345 struct group *grp;
346 char sbuf[INT_BUFSIZE_BOUND (uintmax_t)]; 346 char *sptr = NULL;
347 char *sptr; 347 size_t slen = 0;
348 size_t slen;
349 int pad; 348 int pad;
350 char *user_name; 349 char *user_name;
351 char *group_name; 350 char *group_name;
@@ -378,7 +377,8 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
378 group_name = grp->gr_name; 377 group_name = grp->gr_name;
379 378
380 /* Size */ 379 /* Size */
381 sptr = umaxtostr (info->sb.st_size, sbuf); 380 if (grecs_asprintf (&sptr, &slen, "%lu", (unsigned long) info->sb.st_size))
381 xalloc_die ();
382 382
383 /* Figure out padding and format the buffer */ 383 /* Figure out padding and format the buffer */
384 slen = strlen (sptr); 384 slen = strlen (sptr);
@@ -392,6 +392,7 @@ format_file_data (struct file_triplet *trp, enum file_type type, char **pret)
392 sptr, 392 sptr,
393 timebuf, info->name)) 393 timebuf, info->name))
394 xalloc_die (); 394 xalloc_die ();
395 free (sptr);
395 *pret = buf; 396 *pret = buf;
396 return 0; 397 return 0;
397} 398}
@@ -584,25 +585,27 @@ expand_check_result (struct metadef *def, void *data)
584{ 585{
585 struct file_triplet *trp = data; 586 struct file_triplet *trp = data;
586 int status = trp->check_result; 587 int status = trp->check_result;
587 char sbuf[INT_BUFSIZE_BOUND (uintmax_t)];
588 588
589 if (status == 0) 589 if (status == 0)
590 return def->value = "0"; 590 return def->value = "0";
591 else if (WIFEXITED (status)) 591 else if (WIFEXITED (status))
592 { 592 {
593 char *p = umaxtostr (WEXITSTATUS (status), sbuf); 593 size_t size = 0;
594 def->storage = xstrdup (p); 594 def->storage = NULL;
595 if (grecs_asprintf (&def->storage, &size,
596 "%d", WEXITSTATUS (status)))
597 xalloc_die ();
595 } 598 }
596 else if (WIFSIGNALED (status)) 599 else if (WIFSIGNALED (status))
597 { 600 {
598 char *p = umaxtostr (WTERMSIG (status), sbuf);
599 size_t size = 0; 601 size_t size = 0;
600 def->storage = NULL; 602 def->storage = NULL;
601 if (grecs_asprintf (&def->storage, &size, "SIG+%s", p)) 603 if (grecs_asprintf (&def->storage, &size, "SIG+%d",
604 WTERMSIG (status)))
602 xalloc_die (); 605 xalloc_die ();
603 } 606 }
604 else 607 else
605 def->storage = "[unrecognized return code]"; 608 return def->value = "[unrecognized return code]";
606 return def->value = def->storage; 609 return def->value = def->storage;
607} 610}
608 611
diff --git a/src/wydawca.c b/src/wydawca.c
index 12649d3..171b97b 100644
--- a/src/wydawca.c
+++ b/src/wydawca.c
@@ -175,8 +175,11 @@ stat_mask_p (unsigned long mask)
175static const char * 175static const char *
176stat_expand (struct metadef *def, void *data) 176stat_expand (struct metadef *def, void *data)
177{ 177{
178 char sbuf[INT_BUFSIZE_BOUND (wydawca_stat[0])]; 178 size_t size = 0;
179 def->storage = xstrdup (uinttostr (wydawca_stat[(int) def->data], sbuf)); 179 def->storage = NULL;
180 if (grecs_asprintf (&def->storage, &size, "%u",
181 wydawca_stat[(int) def->data]))
182 xalloc_die ();
180 def->value = def->storage; 183 def->value = def->storage;
181 return def->value; 184 return def->value;
182} 185}

Return to:

Send suggestions and report system problems to the System administrator.