##// END OF EJS Templates
osutil: tolerate Py_GetArgcArgv not being set up properly...
Kyle Lippincott -
r43232:d6227c6c default
parent child Browse files
Show More
@@ -798,10 +798,17 b' static PyObject *setprocname(PyObject *s'
798 char *argvend;
798 char *argvend;
799 extern void Py_GetArgcArgv(int *argc, char ***argv);
799 extern void Py_GetArgcArgv(int *argc, char ***argv);
800 Py_GetArgcArgv(&argc, &argv);
800 Py_GetArgcArgv(&argc, &argv);
801 /* Py_GetArgcArgv may not do much if a custom python
802 * launcher is used that doesn't record the information
803 * it needs. Let's handle this gracefully instead of
804 * segfaulting. */
805 if (argv != NULL)
806 argvend = argvstart = argv[0];
807 else
808 argvend = argvstart = NULL;
801
809
802 /* Check the memory we can use. Typically, argv[i] and
810 /* Check the memory we can use. Typically, argv[i] and
803 * argv[i + 1] are continuous. */
811 * argv[i + 1] are continuous. */
804 argvend = argvstart = argv[0];
805 for (i = 0; i < argc; ++i) {
812 for (i = 0; i < argc; ++i) {
806 if (argv[i] > argvend || argv[i] < argvstart)
813 if (argv[i] > argvend || argv[i] < argvstart)
807 break; /* not continuous */
814 break; /* not continuous */
General Comments 0
You need to be logged in to leave comments. Login now