summaryrefslogtreecommitdiffstats
path: root/src/glsl/apps/purify.c
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-09-17 10:45:16 +0200
committerMichal Krol <michal@vmware.com>2009-09-17 10:45:16 +0200
commit69bdd47dba1f7331a632316e4f9cc9942fb93ca4 (patch)
tree895f639d296d883377a79830913ef7f46701701a /src/glsl/apps/purify.c
parentcc629940d4a47c998d0ed5dbcc0f396025932e0e (diff)
glsl/apps: Always write out error condition.
Diffstat (limited to 'src/glsl/apps/purify.c')
-rw-r--r--src/glsl/apps/purify.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/glsl/apps/purify.c b/src/glsl/apps/purify.c
index 7dff8aea456..d4c53704e54 100644
--- a/src/glsl/apps/purify.c
+++ b/src/glsl/apps/purify.c
@@ -54,14 +54,26 @@ main(int argc,
size = ftell(in);
fseek(in, 0, SEEK_SET);
+ out = fopen(argv[2], "wb");
+ if (!out) {
+ fclose(in);
+ return 1;
+ }
+
inbuf = malloc(size + 1);
if (!inbuf) {
+ fprintf(out, "$OOMERROR\n");
+
+ fclose(out);
fclose(in);
return 1;
}
if (fread(inbuf, 1, size, in) != size) {
+ fprintf(out, "$READERROR\n");
+
free(inbuf);
+ fclose(out);
fclose(in);
return 1;
}
@@ -72,18 +84,15 @@ main(int argc,
memset(&options, 0, sizeof(options));
if (sl_pp_purify(inbuf, &options, &outbuf)) {
+ fprintf(out, "$PURIFYERROR\n");
+
free(inbuf);
+ fclose(out);
return 1;
}
free(inbuf);
- out = fopen(argv[2], "wb");
- if (!out) {
- free(outbuf);
- return 1;
- }
-
fwrite(outbuf, 1, strlen(outbuf), out);
free(outbuf);