From 806b9602e65ebe7faf4546218ff6f83bdd5e02b2 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 23 May 2011 16:34:53 +0000 Subject: [PATCH] Replaced some large local variables by other means in libburn/sg-dummy.c --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/sg-dummy.c | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index f41ac15..0f4e05e 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2011.05.23.155217" +#define Cdrskin_timestamP "2011.05.23.163506" diff --git a/libburn/sg-dummy.c b/libburn/sg-dummy.c index 013b54c..5b440bf 100644 --- a/libburn/sg-dummy.c +++ b/libburn/sg-dummy.c @@ -251,9 +251,12 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) struct statvfs vfsbuf; #endif - char testpath[4096], *cpt; + char *testpath = NULL, *cpt; long blocks; off_t add_size = 0; + int ret; + + BURN_ALLOC_MEM(testpath, char, 4096); testpath[0] = 0; blocks = *bytes / 512; @@ -267,18 +270,18 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) else *cpt = 0; if (stat(testpath, &stbuf) == -1) - return -1; + {ret = -1; goto ex;} #ifdef Libburn_if_this_was_linuX } else if(S_ISBLK(stbuf.st_mode)) { fd = open(path, open_mode); if (fd == -1) - return -2; + {ret = -2; goto ex;} ret = ioctl(fd, BLKGETSIZE, &blocks); close(fd); if (ret == -1) - return -2; + {ret = -2; goto ex;} *bytes = ((off_t) blocks) * (off_t) 512; #endif /* Libburn_if_this_was_linuX */ @@ -287,25 +290,28 @@ int burn_os_stdio_capacity(char *path, off_t *bytes) add_size = stbuf.st_blocks * (off_t) 512; strcpy(testpath, path); } else - return 0; + {ret = 0; goto ex;} if (testpath[0]) { #ifdef Libburn_os_has_statvfS if (statvfs(testpath, &vfsbuf) == -1) - return -2; + {ret = -2; goto ex;} *bytes = add_size + ((off_t) vfsbuf.f_frsize) * (off_t) vfsbuf.f_bavail; #else /* Libburn_os_has_statvfS */ - return 0; + {ret = 0; goto ex;} #endif /* ! Libburn_os_has_stavtfS */ } - return 1; + ret = 1; +ex:; + BURN_FREE_MEM(testpath); + return ret; }