/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: teddy at bsnet
  • Date: 2011-12-23 19:00:36 UTC
  • mfrom: (505.1.26 teddy)
  • Revision ID: teddy@fukt.bsnet.se-20111223190036-jwsod6mu1bex9uro
Merge from Teddy

Show diffs side-by-side

added added

removed removed

Lines of Context:
2405
2405
                del client_settings[client.name]["secret"]
2406
2406
        
2407
2407
        try:
2408
 
            with os.fdopen(os.open(stored_state_path,
2409
 
                                   (os.O_CREAT | os.O_WRONLY
2410
 
                                    | os.O_TRUNC | os.O_EXCL),
2411
 
                                   (stat.S_IREAD | stat.S_IWRITE)),
2412
 
                           "wb") as stored_state:
 
2408
            tempfd, tempname = tempfile.mkstemp(suffix=".pickle",
 
2409
                                                prefix="clients-",
 
2410
                                                dir=os.path.dirname
 
2411
                                                (stored_state_path))
 
2412
            with os.fdopen(tempfd, "wb") as stored_state:
2413
2413
                pickle.dump((clients, client_settings), stored_state)
 
2414
            os.rename(tempname, stored_state_path)
2414
2415
        except (IOError, OSError) as e:
2415
2416
            logger.warning("Could not save persistent state: {0}"
2416
2417
                           .format(e))