History

fswstat: can't modify automatic variables that get used in waseror() handler

cinap_lenrek committed 8 years ago

Commit fd5ced81 parent aa140ab2 files · +10 −5Browse files

Unified · Split

2 files
  1. kern/devfs-posix.c +4 −4
  2. kern/devfs-win32.c +6 −1
kern/devfs-posix.c+4−4
@@ -422,13 +422,13 @@ fswstat(Chan *c, uchar *buf, int n) · 421 unmodified lines
422 char *base, *newpath;422 char *base, *newpath;
423 423
424 base = strdup(uif->path);424 base = strdup(uif->path);
425 *lastelem(base) = 0;
426 newpath = catpath(base, d.name);
427 free(base);
425 if(waserror()){428 if(waserror()){
426 free(base);429 free(newpath);
427 nexterror();430 nexterror();
428 }431 }
429 *lastelem(base) = 0;
430 newpath = catpath(base, d.name);
431 free(base), base = newpath;
432 if(rename(uif->path, newpath) < 0)432 if(rename(uif->path, newpath) < 0)
433 error(strerror(errno));433 error(strerror(errno));
434 free(uif->path);434 free(uif->path);
kern/devfs-win32.c+6−1
@@ -634,7 +634,12 @@ fswstat(Chan *c, uchar *buf, int n) · 633 unmodified lines
634 error(Ebadstat);634 error(Ebadstat);
635 base[l] = 0;635 base[l] = 0;
636 newpath = catpath(base, d.name, nil);636 newpath = catpath(base, d.name, nil);
637 free(base), base = newpath;637 free(base);
638 poperror();
639 if(waserror()){
640 free(newpath);
641 nexterror();
642 }
638 if(wcscmp(uif->path, newpath)!=0){643 if(wcscmp(uif->path, newpath)!=0){
639 if(!MoveFile(uif->path, newpath))644 if(!MoveFile(uif->path, newpath))
640 oserror();645 oserror();

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