Changeset 32428


Ignore:
Timestamp:
Jun 22, 2017, 12:43:25 PM (5 weeks ago)
Author:
brainslayer
Message:

consider context

Location:
src/router/httpd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/httpd.h

    r32283 r32428  
    7575        char label[64];
    7676        char my_next_page[30];
     77        int upgrade_ret;
     78        int restore_ret;
    7779
    7880/* CGI hash table */
  • src/router/httpd/modules/nvramsr.c

    r32016 r32428  
    3131 */
    3232
    33 static int restore_ret;
    3433
    3534void nv_file_in(char *url, webs_t wp, int len, char *boundary)
     
    3736
    3837        char buf[1024];
    39         restore_ret = EINVAL;
     38        wp->restore_ret = EINVAL;
    4039#ifdef HAVE_REGISTER
    4140        if (!isregistered_real()) {
     
    8079        int ret = nvram_restore("/tmp/restore.bin");
    8180        if (ret < 0)
    82                 restore_ret = 99;
     81                wp->restore_ret = 99;
    8382        else
    84                 restore_ret = 0;
     83                wp->restore_ret = 0;
    8584        unlink("/tmp/restore.bin");
    8685        chdir("/www");
     
    8988void sr_config_cgi(unsigned char method, struct mime_handler *handler, char *path, webs_t wp, char *query)
    9089{
    91         if (restore_ret != 0)
     90        if (wp->restore_ret != 0)
    9291                do_ej(METHOD_GET, handler, "Fail.asp", wp, NULL);
    9392        else
     
    9998         * Reboot if successful
    10099         */
    101         if (restore_ret == 0) {
     100        if (wp->restore_ret == 0) {
    102101                nvram_commit();
    103102                sleep(5);
  • src/router/httpd/modules/upgrade.c

    r32206 r32428  
    4545#endif
    4646#define CODE_PATTERN_ERROR 9999
    47 static int upgrade_ret;
    4847static char upload_fifo[] = "/tmp/uploadXXXXXX";
    49 void set_upgrade_ret(int result)
     48void set_upgrade_ret(webs_t stream, int result)
    5049{
    5150        if (result != 0) {
    52                 upgrade_ret = result;
     51                stream->upgrade_ret = result;
    5352        } else {
    54                 upgrade_ret = NULL;
     53                stream->upgrade_ret = NULL;
    5554        }
    5655}
     
    6362#ifndef ANTI_FLASH
    6463
    65         fprintf(stderr, "[UPGRADE] ret: %d\n", upgrade_ret);
    66         if (upgrade_ret) {
     64        fprintf(stderr, "[UPGRADE] ret: %d\n", stream->upgrade_ret);
     65        if (stream->upgrade_ret) {
    6766                do_ej(METHOD_GET, handler, "Fail_u_s.asp", stream, NULL);
    6867                killall("ledtool", SIGTERM);
     
    7675         * Reboot if successful
    7776         */
    78         if (upgrade_ret == 0) {
     77        if (stream->upgrade_ret == 0) {
    7978                // sleep (10);
    8079                sys_reboot();
     
    667666        int type = 0;
    668667        char *buf = malloc(1024);
    669         upgrade_ret = EINVAL;
     668        stream->upgrade_ret = EINVAL;
    670669
    671670        /*
     
    718717                        break;
    719718        }
    720 
    721         upgrade_ret = sys_upgrade(NULL, stream, &len, type);
     719        stream->upgrade_ret = sys_upgrade(NULL, stream, &len, type);
    722720
    723721        /*
Note: See TracChangeset for help on using the changeset viewer.