| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/importer/firefox_profile_lock.h" | 5 #include "chrome/browser/importer/firefox_profile_lock.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| 11 | 11 |
| 12 #include "base/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 | 13 |
| 14 // This class is based on Firefox code in: | 14 // This class is based on Firefox code in: |
| 15 // profile/dirserviceprovider/src/nsProfileLock.cpp | 15 // profile/dirserviceprovider/src/nsProfileLock.cpp |
| 16 // The license block is: | 16 // The license block is: |
| 17 | 17 |
| 18 /* ***** BEGIN LICENSE BLOCK ***** | 18 /* ***** BEGIN LICENSE BLOCK ***** |
| 19 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 19 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 20 * | 20 * |
| 21 * The contents of this file are subject to the Mozilla Public License Version | 21 * The contents of this file are subject to the Mozilla Public License Version |
| 22 * 1.1 (the "License"); you may not use this file except in compliance with | 22 * 1.1 (the "License"); you may not use this file except in compliance with |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 lock_fd_ = -1; | 115 lock_fd_ = -1; |
| 116 if (errno == EAGAIN || errno == EACCES) | 116 if (errno == EAGAIN || errno == EACCES) |
| 117 return false; | 117 return false; |
| 118 else | 118 else |
| 119 return true; | 119 return true; |
| 120 } else { | 120 } else { |
| 121 // We have the lock. | 121 // We have the lock. |
| 122 return true; | 122 return true; |
| 123 } | 123 } |
| 124 } | 124 } |
| OLD | NEW |