| 1 | From: Michael Banck <[email protected]> |
| 2 | Subject: Honor umask when saving a gif animation by changing the permissions accordingly afterwards. |
| 3 | |
| 4 | --- a/src/gifSave.cpp |
| 5 | +++ b/src/gifSave.cpp |
| 6 | @@ -9,6 +9,8 @@ |
| 7 | |
| 8 | #include <gif_lib.h> |
| 9 | #include <stdio.h> |
| 10 | +#include <sys/types.h> |
| 11 | +#include <sys/stat.h> |
| 12 | |
| 13 | #include <vector> |
| 14 | |
| 15 | @@ -181,6 +183,10 @@ |
| 16 | |
| 17 | if (EGifCloseFile(GifFile) == GIF_ERROR) return false; |
| 18 | |
| 19 | + mode_t mask = umask(0); |
| 20 | + umask(mask); |
| 21 | + chmod(filename, mask ^ 0666); |
| 22 | + |
| 23 | return true; |
| 24 | } |
| 25 |