patch-nix_machine_c 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. $OpenBSD: patch-nix_machine_c,v 1.3 2013/04/03 15:14:17 naddy Exp $
  2. --- nix/machine.c.orig Thu Jan 12 07:53:00 1995
  3. +++ nix/machine.c Wed Apr 3 17:05:00 2013
  4. @@ -20,6 +20,7 @@
  5. ***********************************************************************/
  6. #include <stdlib.h>
  7. +#include <string.h>
  8. #include <ctype.h>
  9. #include <stdio.h>
  10. #include <sys/types.h>
  11. @@ -335,8 +336,10 @@ char *md_timestring(unsigned long t) {
  12. static char ts[22];
  13. struct tm *tim;
  14. + time_t tt;
  15. - tim=localtime((long *)&t);
  16. + tt = t;
  17. + tim=localtime(&tt);
  18. sprintf(ts,"%04d-%02d-%02d %02d:%02d",tim->tm_year+1900,tim->tm_mon+1,
  19. tim->tm_mday,tim->tm_hour,tim->tm_min);
  20. return ts;
  21. @@ -417,7 +420,7 @@ char *md_stripname(char *mdfullpath) {
  22. if (plainname!=NULL) free(plainname),plainname=NULL;
  23. if ((plainname=malloc(strlen(mdfullpath)+1))==NULL)
  24. error(1,ERR_MEM,"md_stripname()");
  25. - for (i=strlen(mdfullpath)-1;i>0;i--) {
  26. + for (i=strlen(mdfullpath)-1;i>=0;i--) {
  27. if (mdfullpath[i]=='/') {
  28. i++;
  29. break;