Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(684)

Side by Side Diff: dbus_service.cc

Issue 3437019: [update_engine] handle NULL returns from strdup (Closed) Base URL: http://git.chromium.org/git/update_engine.git
Patch Set: fixed nits. Pushing... Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | subprocess.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 "update_engine/dbus_service.h" 5 #include "update_engine/dbus_service.h"
6 #include <string> 6 #include <string>
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "update_engine/marshal.glibmarshal.h" 8 #include "update_engine/marshal.glibmarshal.h"
9 9
10 using std::string; 10 using std::string;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 string new_version_str; 70 string new_version_str;
71 71
72 CHECK(self->update_attempter_->GetStatus(last_checked_time, 72 CHECK(self->update_attempter_->GetStatus(last_checked_time,
73 progress, 73 progress,
74 &current_op, 74 &current_op,
75 &new_version_str, 75 &new_version_str,
76 new_size)); 76 new_size));
77 77
78 *current_operation = strdup(current_op.c_str()); 78 *current_operation = strdup(current_op.c_str());
79 *new_version = strdup(new_version_str.c_str()); 79 *new_version = strdup(new_version_str.c_str());
80 if (!(*current_operation && *new_version)) {
81 *error = NULL;
82 return FALSE;
83 }
80 return TRUE; 84 return TRUE;
81 } 85 }
82 86
83 gboolean update_engine_service_reboot_if_needed(UpdateEngineService* self, 87 gboolean update_engine_service_reboot_if_needed(UpdateEngineService* self,
84 GError **error) { 88 GError **error) {
85 if (!self->update_attempter_->RebootIfNeeded()) { 89 if (!self->update_attempter_->RebootIfNeeded()) {
86 *error = NULL; 90 *error = NULL;
87 return FALSE; 91 return FALSE;
88 } 92 }
89 return TRUE; 93 return TRUE;
90 } 94 }
91 95
92 gboolean update_engine_service_emit_status_update( 96 gboolean update_engine_service_emit_status_update(
93 UpdateEngineService* self, 97 UpdateEngineService* self,
94 gint64 last_checked_time, 98 gint64 last_checked_time,
95 gdouble progress, 99 gdouble progress,
96 const gchar* current_operation, 100 const gchar* current_operation,
97 const gchar* new_version, 101 const gchar* new_version,
98 gint64 new_size) { 102 gint64 new_size) {
99 g_signal_emit(self, 103 g_signal_emit(self,
100 status_update_signal, 104 status_update_signal,
101 0, 105 0,
102 last_checked_time, 106 last_checked_time,
103 progress, 107 progress,
104 current_operation, 108 current_operation,
105 new_version, 109 new_version,
106 new_size); 110 new_size);
107 return TRUE; 111 return TRUE;
108 } 112 }
OLDNEW
« no previous file with comments | « no previous file | subprocess.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698