瀏覽代碼

fix strftime regression in %e format

%e pads with spaces instead of zeros.
Rich Felker 11 年之前
父節點
當前提交
2828a130b1
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/time/strftime.c

+ 2 - 2
src/time/strftime.c

@@ -80,8 +80,8 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
 		fmt = "%m/%d/%y";
 		goto recu_strftime;
 	case 'e':
-		val = tm->tm_mday;
-		goto number;
+		*l = snprintf(*s, sizeof *s, "%2d", tm->tm_mday);
+		return *s;
 	case 'F':
 		fmt = "%Y-%m-%d";
 		goto recu_strftime;