Modify bits for old files also.
authorsapanb <sapanb@8c455092-636d-4788-adf5-e71def0336e8>
Tue, 1 Jul 2008 20:26:14 +0000 (20:26 +0000)
committersapanb <sapanb@8c455092-636d-4788-adf5-e71def0336e8>
Tue, 1 Jul 2008 20:26:14 +0000 (20:26 +0000)
git-svn-id: http://svn.planet-lab.org/svn/fprobe-ulog/trunk@9777 8c455092-636d-4788-adf5-e71def0336e8

src/fprobe-ulog.c

index 37ecde3..a9f0461 100644 (file)
@@ -474,10 +474,13 @@ unsigned get_data_file_fd(char *fname, int cur_fd) {
                if (cur_fd>0)
                        close(cur_fd);
                snprintf(nextname,MAX_PATH_LEN,"%s.%d",fname,cur_epoch);
-               if ((write_fd = open(nextname, O_RDWR|O_CREAT|O_TRUNC,S_IRWXU|S_IRGRP|S_IROTH)) < 0) {
+               if ((write_fd = open(nextname, O_RDWR|O_CREAT|O_TRUNC)) < 0) {
                        my_log(LOG_ERR, "open(): %s (%s)\n", nextname, strerror(errno));
                        exit(1);
                }
+               if (fchmod(write_fd,S_IRUSR|S_IWUSR|S_IROTH|S_IRGRP) == -1) {
+                       my_log(LOG_ERR, "fchmod() failed: %s (%s). Continuing...\n", nextname, strerror(errno));
+               }
                update_cur_epoch_file(cur_epoch);
                ret_fd = write_fd;
        }