~ubuntu-branches/ubuntu/lucid/boinc/lucid

« back to all changes in this revision

Viewing changes to client/file_names.C

  • Committer: Bazaar Package Importer
  • Author(s): Frank S. Thomas, Frank S. Thomas
  • Date: 2008-05-31 08:02:47 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20080531080247-4ce890lp2rc768cr
Tags: 6.2.7-1
[ Frank S. Thomas ]
* New upstream release.
  - BOINC Manager: Redraw disk usage charts immediately after connecting to
    a (different) client. (closes: 463823)
* debian/copyright:
  - Added the instructions from debian/README.Debian-source about how
    repackaged BOINC tarballs can be reproduced because DevRef now
    recommends to put this here instead of in the afore-mentioned file.
  - Updated for the new release.
* Removed the obsolete debian/README.Debian-source.
* For consistency upstream renamed the core client and the command tool
  ("boinc_client" to "boinc" and "boinc_cmd" to "boinccmd"). Done the same
  in all packages and created symlinks with the old names for the binaries
  and man pages. Also added an entry in debian/boinc-client.NEWS explaining
  this change.
* debian/rules: Do not list Makefile.ins in the clean target individually,
  just remove all that can be found.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
// To view the GNU Lesser General Public License visit
16
16
// http://www.gnu.org/copyleft/lesser.html
17
17
// or write to the Free Software Foundation, Inc.,
18
 
// 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 
20
20
#include "cpp.h"
21
21
 
39
39
#include "str_util.h"
40
40
#include "util.h"
41
41
#include "client_msgs.h"
 
42
#include "sandbox.h"
42
43
#include "client_state.h"
43
44
 
44
45
#include "file_names.h"
115
116
    mode_t old_mask;
116
117
    if (g_use_sandbox) {
117
118
        old_mask = umask(2);     // Project directories must be world-readable
118
 
        chmod(PROJECTS_DIR,
119
 
                S_IRUSR|S_IWUSR|S_IXUSR
120
 
                |S_IRGRP|S_IWGRP|S_IXGRP
121
 
                |S_IROTH|S_IXOTH
122
 
            );
 
119
         chmod(PROJECTS_DIR,
 
120
            S_IRUSR|S_IWUSR|S_IXUSR
 
121
            |S_IRGRP|S_IWGRP|S_IXGRP
 
122
            |S_IROTH|S_IXOTH
 
123
        );
123
124
        umask(old_mask);
124
125
    }
125
126
#endif
129
130
    if (g_use_sandbox) {
130
131
        old_mask = umask(2);     // Project directories must be world-readable
131
132
        chmod(buf,
132
 
                S_IRUSR|S_IWUSR|S_IXUSR
133
 
                |S_IRGRP|S_IWGRP|S_IXGRP
134
 
                |S_IROTH|S_IXOTH
135
 
            );
 
133
            S_IRUSR|S_IWUSR|S_IXUSR
 
134
            |S_IRGRP|S_IWGRP|S_IXGRP
 
135
            |S_IROTH|S_IXOTH
 
136
        );
136
137
        umask(old_mask);
137
138
        set_to_project_group(buf);
138
139
    }
150
151
        msg_printf(&p, MSG_INTERNAL_ERROR, "Can't delete file %s", boinc_failed_file);
151
152
        return retval;
152
153
    }
153
 
    return boinc_rmdir(buf);
 
154
    return remove_project_owned_dir(buf);
154
155
}
155
156
 
156
157
// Create the slot directory for the specified slot #
168
169
    if (g_use_sandbox) {
169
170
        old_mask = umask(2);     // Slot directories must be world-readable
170
171
        chmod(SLOTS_DIR,
171
 
                S_IRUSR|S_IWUSR|S_IXUSR
172
 
                |S_IRGRP|S_IWGRP|S_IXGRP
173
 
                |S_IROTH|S_IXOTH
174
 
            );
 
172
            S_IRUSR|S_IWUSR|S_IXUSR
 
173
            |S_IRGRP|S_IWGRP|S_IXGRP
 
174
            |S_IROTH|S_IXOTH
 
175
        );
175
176
        umask(old_mask);
176
177
    }
177
178
#endif
181
182
    if (g_use_sandbox) {
182
183
        old_mask = umask(2);     // Slot directories must be world-readable
183
184
        chmod(buf,
184
 
                S_IRUSR|S_IWUSR|S_IXUSR
185
 
                |S_IRGRP|S_IWGRP|S_IXGRP
186
 
                |S_IROTH|S_IXOTH
187
 
            );
 
185
            S_IRUSR|S_IWUSR|S_IXUSR
 
186
            |S_IRGRP|S_IWGRP|S_IXGRP
 
187
            |S_IROTH|S_IXOTH
 
188
        );
188
189
        umask(old_mask);
189
190
        set_to_project_group(buf);
190
191
    }
213
214
 
214
215
            // If BOINC crashes or exits suddenly (e.g., due to 
215
216
            // being called with --exit_after_finish) it may leave 
216
 
            // orphan shared memory segments in the system.  Clean 
217
 
            // these up here. (We must do this before deleting the
 
217
            // orphan shared memory segments in the system.
 
218
            // Clean these up here. (We must do this before deleting the
218
219
            // INIT_DATA_FILE, if any, from each slot directory.)
 
220
            //
219
221
            snprintf(init_data_path, sizeof(init_data_path), "%s/%s", path, INIT_DATA_FILE);
220
222
            shmem_seg_name = ftok(init_data_path, 1);
221
223
            if (shmem_seg_name != -1) {
224
226
#endif
225
227
            if (!gstate.active_tasks.is_slot_dir_in_use(path)) {
226
228
                client_clean_out_dir(path);
227
 
                boinc_rmdir(path);
 
229
                remove_project_owned_dir(path);
228
230
            }
229
231
        } else {
230
232
            delete_project_owned_file(path, false);
302
304
    return false;
303
305
}
304
306
 
305
 
#ifdef SANDBOX
306
 
int set_to_project_group(const char* path) {
307
 
    if (g_use_sandbox) {
308
 
        if (boinc_exec(SETPROJECTGRP_FILE_NAME, (char*)path))
309
 
            return ERR_CHOWN;
310
 
    }
311
 
#else
312
 
int set_to_project_group(const char*) {
313
 
#endif
314
 
    return 0;
315
 
}
316
 
 
317
307
void boinc_version_dir(PROJECT& p, VERSION_INFO& vi, char* buf) {
318
308
        char projdir[1024];
319
309
        get_project_dir(&p, projdir, sizeof(projdir));
325
315
    return (n==3);
326
316
}
327
317
 
328
 
const char *BOINC_RCSID_7d362a6a52 = "$Id: file_names.C 14599 2008-01-18 21:27:33Z romw $";
 
318
const char *BOINC_RCSID_7d362a6a52 = "$Id: file_names.C 14582 2008-01-16 22:10:34Z romw $";