History

Cleanup

cancel committed 6 years ago

Commit ba5a58b1 parent 2a1ad3f1 file · +12 −20Browse files

Unified · Split

sysmisc.c+12−20
@@ -288,35 +288,25 @@ Conf_save_start_error conf_save_start(Conf_save *p, · 287 unmodified lines
288 err = Conf_save_start_no_home;288 err = Conf_save_start_no_home;
289 goto cleanup;289 goto cleanup;
290 }290 }
291 if (!dir) {291 if (!dir)
292 err = Conf_save_start_alloc_failed;292 goto allocfail;
293 goto cleanup;
294 }
295 osoputoso(&p->canonpath, dir);293 osoputoso(&p->canonpath, dir);
296 if (!p->canonpath) {294 if (!p->canonpath)
297 err = Conf_save_start_alloc_failed;295 goto allocfail;
298 goto cleanup;
299 }
300 size_t namelen = strlen(conf_file_name);296 size_t namelen = strlen(conf_file_name);
301 if (namelen == 0) {297 if (namelen == 0) {
302 err = Conf_save_start_bad_conf_name;298 err = Conf_save_start_bad_conf_name;
303 goto cleanup;299 goto cleanup;
304 }300 }
305 conf_impl_catconfpath(&p->canonpath, conf_file_name, namelen);301 conf_impl_catconfpath(&p->canonpath, conf_file_name, namelen);
306 if (!p->canonpath) {302 if (!p->canonpath)
307 err = Conf_save_start_alloc_failed;303 goto allocfail;
308 goto cleanup;
309 }
310 osoputoso(&p->temppath, p->canonpath);304 osoputoso(&p->temppath, p->canonpath);
311 if (!p->temppath) {305 if (!p->temppath)
312 err = Conf_save_start_alloc_failed;306 goto allocfail;
313 goto cleanup;
314 }
315 osocat(&p->temppath, ".tmp");307 osocat(&p->temppath, ".tmp");
316 if (!p->temppath) {308 if (!p->temppath)
317 err = Conf_save_start_alloc_failed;309 goto allocfail;
318 goto cleanup;
319 }
320 // Remove old temp file if it exists. If it exists and we can't remove it,310 // Remove old temp file if it exists. If it exists and we can't remove it,
321 // error.311 // error.
322 if (unlink(osoc(p->temppath)) == -1 && errno != ENOENT) {312 if (unlink(osoc(p->temppath)) == -1 && errno != ENOENT) {
@@ -350,6 +340,8 @@ Conf_save_start_error conf_save_start(Conf_save *p, · 27 unmodified lines
350 osofree(dir);340 osofree(dir);
351 return Conf_save_start_ok;341 return Conf_save_start_ok;
352 342
343allocfail:
344 err = Conf_save_start_alloc_failed;
353cleanup:345cleanup:
354 osofree(dir);346 osofree(dir);
355 conf_save_cancel(p);347 conf_save_cancel(p);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t