/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 Hogeborn
  • Date: 2012-05-06 17:37:23 UTC
  • Revision ID: teddy@recompile.se-20120506173723-znhgx61gpqp1rfor
* mandos (main.cleanup): Use tempfile.NamedTemporaryFile() instead of
                         tempfile.mkstemp().

Show diffs side-by-side

added added

removed removed

Lines of Context:
2564
2564
                del client_settings[client.name]["secret"]
2565
2565
        
2566
2566
        try:
2567
 
            tempfd, tempname = tempfile.mkstemp(suffix=".pickle",
2568
 
                                                prefix="clients-",
2569
 
                                                dir=os.path.dirname
2570
 
                                                (stored_state_path))
2571
 
            with os.fdopen(tempfd, "wb") as stored_state:
 
2567
            with (tempfile.NamedTemporaryFile
 
2568
                  (mode='wb', suffix=".pickle", prefix='clients-',
 
2569
                   dir=os.path.dirname(stored_state_path),
 
2570
                   delete=False)) as stored_state:
2572
2571
                pickle.dump((clients, client_settings), stored_state)
 
2572
                tempname=stored_state.name
2573
2573
            os.rename(tempname, stored_state_path)
2574
2574
        except (IOError, OSError) as e:
2575
2575
            if not debug: