Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 12493 Details for
Bug 21826
Ebuild for kpnadsl4linux-1.10 with patches to ao. fix the restart feature
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
patch adsl.c
adsl.c.patch (text/plain), 7.51 KB, created by
Sam
on 2003-05-28 08:00:21 UTC
(
hide
)
Description:
patch adsl.c
Filename:
MIME Type:
Creator:
Sam
Created:
2003-05-28 08:00:21 UTC
Size:
7.51 KB
patch
obsolete
>*** adsl.c Sun May 11 10:35:05 2003 >--- adsl.c.new Sun May 11 10:37:05 2003 >*************** >*** 16,22 **** > # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > # > # --------------------------------------------------------------------------- >! # ADSL4LINUX ADSL MAIN CONTROL BINARY > # --------------------------------------------------------------------------- > # > # $Id: cyberdude47 Exp $ >--- 16,22 ---- > # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. > # > # --------------------------------------------------------------------------- >! # ADSL4LINUX ADSL MAIN CONTROL BINARY > # --------------------------------------------------------------------------- > # > # $Id: cyberdude47 Exp $ >*************** >*** 60,73 **** > if (strcmp(argv[1], "stop") == 0) > { > return stop(); >! } > if (strcmp(argv[1], "version") == 0) > { > return version(); > } > if (strcmp(argv[1], "restart") == 0) > { >! return restart(); > } > > if (strcmp(argv[1], "status") == 0) >--- 60,73 ---- > if (strcmp(argv[1], "stop") == 0) > { > return stop(); >! } > if (strcmp(argv[1], "version") == 0) > { > return version(); > } > if (strcmp(argv[1], "restart") == 0) > { >! return restart(argc, argv[0], argv[2]); > } > > if (strcmp(argv[1], "status") == 0) >*************** >*** 85,91 **** > > return startlogging(); > } >- > if (strcmp(argv[1], "stoplog") == 0 && uid == 0) > { > if ( !isAdslUp() ) >--- 85,90 ---- >*************** >*** 96,117 **** > > if (strcmp(argv[1], "update") == 0) > { >! if ( !isAdslUp() ) > return 1; > return usagelogging(); >! } >! >! return usage(argv[0]); > } > > int usage(char *programpath) > { >! fprintf(stderr,"\nUsage: %s {start|stop|status|version}\n", programpath); > fprintf(stderr," Status options:\n"); >! fprintf(stderr,"\tstatus only show counters\n"); >! fprintf(stderr,"\tstartlog start logging (root only)\n"); >! fprintf(stderr,"\tstoplog stop logging (root only)\n"); >! fprintf(stderr,"\tupdate update counters in logging (root only)\n"); > > return 0; > } >--- 95,117 ---- > > if (strcmp(argv[1], "update") == 0) > { >! if ( !isAdslUp() ) > return 1; > return usagelogging(); >! } >! >! return usage(argv[0]); > } > > int usage(char *programpath) > { >! fprintf(stderr,"Usage: %s {start|stop|status|version}\n", programpath); > fprintf(stderr," Status options:\n"); >! fprintf(stderr,"\tstatus only show counters\n"); >! fprintf(stderr,"\tstartlog start logging (root only)\n"); >! fprintf(stderr,"\tstoplog stop logging (root only)\n"); >! fprintf(stderr,"\tupdate update counters in logging (root only)\n"); >! fprintf(stderr,"\nPlease report bugs to cyberdude47@hotmail.com\n"); > > return 0; > } >*************** >*** 163,169 **** > } > else > { >! printf("\nUsage: %s start pc<number 1 to 4>\n", name); > printf("Example: %s start pc2\n", name); > return 1; > } >--- 163,169 ---- > } > else > { >! printf("Usage: %s start pc<number 1 to 4>\n", name); > printf("Example: %s start pc2\n", name); > return 1; > } >*************** >*** 188,209 **** > } > else > { >! printf("\nError: connection already available!\n"); > return 1; > } > > if (waitforconnection()) > { >! printf("\nConnection Established\n"); > sleep(5); > >! isAdslUp(); > startlogging(); > return 0; > } > else > { >! printf("\nConnection FAILED!\n"); > return 1; > } > } >--- 188,209 ---- > } > else > { >! printf("Error: connection already available!\n"); > return 1; > } > > if (waitforconnection()) > { >! printf("Connection Established\n"); > sleep(5); > >! isAdslUp(); > startlogging(); > return 0; > } > else > { >! printf("Connection FAILED!\n"); > return 1; > } > } >*************** >*** 239,251 **** > > if (!kill(ppppid, 0) || isadslrunning() ) > { >! printf("FAILED\n"); > return 2; > } > else > { >! printf("OK\n"); >! return 0; > } > } > else >--- 239,251 ---- > > if (!kill(ppppid, 0) || isadslrunning() ) > { >! printf(" FAILED!\nYou might need to be root to stop the connection.\n"); > return 2; > } > else > { >! printf(" OK\n"); >! return 0; > } > } > else >*************** >*** 257,317 **** > return 0; > } > >! int restart() >! { >! fprintf(stderr, "restart has not yet been implemented.\n"); >! return 1; >! // return !(!stop() && !start(programpath)) >! /* int out; > pid_t ppppid; >- int j; > >! if ( !isadslrunning() ){ >! printf("\nADSL connection already down.\n"); >! return 1;} > else > { >! ppppid = getpidofconn(STAT_FILE); >! >! out=kill(ppppid, SIGHUP); >! printf("Old pppd shutting down"); >! >! for(j=0; j<RETRY; j++) >! if (!kill(ppppid, 0)) >! { >! printf("."); >! fflush(stdout); >! sleep(SLEEP); >! } >! else >! break; > >! if (kill(ppppid, 0)) > { >! printf("OK\n"); >! printf("Setting up new connection"); > >! if (waitforconnection()) > { >! printf("\nConnection Established\n"); >! sleep(5); >! >! isAdslUp(); >! startlogging(); >! return 0; > } > else >! { >! printf("\nConnection FAILED!\n"); >! return 1; >! } > } > else >! printf("FAILED\n"); >! } > >! return out; >! */ > } > > int version(void) >--- 257,373 ---- > return 0; > } > >! int restart(int argr, char name[10], char arg[5]) >! { >! int out; > pid_t ppppid; > >! int j; >! if ( !isAdslUp() ) >! { >! printf("\nADSL connection already down.\nCan't restart it.\n"); >! return 1; >! } > else > { >! stoplogging(); > >! ppppid=getpidofconn(STAT_FILE); >! if (ppppid > 1) > { >! printf("\nSending SIGTERM to pppd(%d)",ppppid); >! kill(ppppid, SIGTERM); > >! for(j=0; j<RETRY; j++) >! if (!kill(ppppid, 0) || isadslrunning()) > { >! printf("."); >! fflush(stdout); >! sleep(SLEEP); > } >+ else >+ break; >+ >+ if (!kill(ppppid, 0) || isadslrunning() ) >+ { >+ printf("Failed stopping the connection\n"); >+ return 2; >+ } > else >! { >! printf("\nConnection stopped succesfully\n"); >! } > } > else >! { >! printf("\nError fetching pid!\n"); >! return 1; >! } > >! sleep(5); >! int pc; >! if ( argr < 3) >! { >! pc=1; >! } >! else if (strcmp(arg, "pc1") == 0) >! { >! pc=1; >! } >! else if (strcmp(arg, "pc2") == 0) >! { >! pc=2; >! } >! else if (strcmp(arg, "pc3") == 0) >! { >! pc=3; >! } >! else if (strcmp(arg, "pc4") == 0) >! { >! pc=4; >! } >! else >! { >! printf("\nUsage: %s start pc<number 1 to 4>\n", name); >! printf("Example: %s start pc2\n", name); >! return 1; >! } >! >! switch(pc) >! { >! case 1: >! out=system("pppd call adsl"); >! break; >! case 2: >! out=system("pppd call adsl2"); >! break; >! case 3: >! out=system("pppd call adsl3"); >! break; >! case 4: >! out=system("pppd call adsl4"); >! break; >! } >! >! printf("\nEstablishing connection"); >! >! if (waitforconnection()) >! { >! printf("\nConnection Established\n"); >! sleep(5); >! >! isAdslUp(); >! startlogging(); >! return 0; >! } >! else >! { >! printf("\nCouldn't establish connection!\n"); >! return 1; >! } >! >! return 0; >! } > } > > int version(void) >*************** >*** 383,389 **** > int isadslrunning() > { > struct stat st; >- > return (stat(STATFILE, &st)>=0); > } > >--- 439,444 ---- >*************** >*** 401,405 **** > > return result; > } >- >- >--- 456,458 ----
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 21826
:
12488
|
12489
|
12490
|
12491
|
12492
| 12493 |
12494
|
12495
|
12496