diff options
| author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-06 08:58:03 +0100 | 
|---|---|---|
| committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-06 08:58:03 +0100 | 
| commit | 3951b5f55066c381f8c399791bb8740b2404700d (patch) | |
| tree | 09cb19138fc7ae8c45dcf3b4cdc281c7913e382b | |
| parent | 8bcf359285fba13624ef4eea774ff4801045b203 (diff) | |
copy input for dirname(3) (reported by David Mitchell)
| -rw-r--r-- | src/ImageMetaData.cxx | 5 | 
1 files changed, 4 insertions, 1 deletions
| diff --git a/src/ImageMetaData.cxx b/src/ImageMetaData.cxx index 5e0102a..cfa699e 100644 --- a/src/ImageMetaData.cxx +++ b/src/ImageMetaData.cxx @@ -215,8 +215,11 @@ ImageMetaData::save_image_jpgcom(char *in_img, char *out_img) {      int status, err = 0;      ssize_t n;  	int tmp_fd; +	char *dirbuf; -	snprintf(tmpname, sizeof(tmpname), "%s/.gipfelXXXXXX", dirname(out_img)); +	dirbuf = strdup(out_img); +	snprintf(tmpname, sizeof(tmpname), "%s/.gipfelXXXXXX", dirname(dirbuf)); +	free(dirbuf);  	tmp_fd = mkstemp(tmpname);  	if (tmp_fd < 0) {  		perror("mkstemp"); | 
