Mercurial > pt1.oyama
diff recpt1/recpt1.c @ 63:ca419e61f7f2
fix for a bug that recpt1 crashes if dirname(3) returns '.'
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 10 Oct 2009 01:11:34 +0900 |
parents | c6a5c844c7fd |
children | 18108d097707 |
line wrap: on
line diff
--- a/recpt1/recpt1.c Fri Oct 09 14:02:18 2009 +0900 +++ b/recpt1/recpt1.c Sat Oct 10 01:11:34 2009 +0900 @@ -786,11 +786,12 @@ else { if(!fileless) { int status; - char *dir = dirname(strdup(argv[optind + 2])); + char *path = strdup(argv[optind + 2]); + char *dir = dirname(path); status = mkpath(dir, 0777); if(status == -1) perror("mkpath"); - free(dir); + free(path); wfd = open(argv[optind + 2], (O_RDWR | O_CREAT | O_TRUNC), 0666); if(wfd < 0) {