mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	missing/setproctitle.c: Avoid invalidating argv[1], argv[2], etc. until the first call to Process.setproctitle, because the ps command of AIX refers to the argv array. [Bug #10090]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									ecb57e4327
								
							
						
					
					
						commit
						f3754f57cb
					
				
					 2 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,10 @@
 | 
			
		|||
Thu Oct  9 07:20:30 2014  Rei Odaira  <Rei.Odaira@gmail.com>
 | 
			
		||||
 | 
			
		||||
	* missing/setproctitle.c: Avoid invalidating argv[1], argv[2],
 | 
			
		||||
	  etc. until the first call to Process.setproctitle, because
 | 
			
		||||
	  the ps command of AIX refers to the argv array.
 | 
			
		||||
	  [Bug #10090]
 | 
			
		||||
 | 
			
		||||
Thu Oct  9 00:53:15 2014  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* dir.c (dir_s_aref): fix rdoc.  `Dir.glob` allows an array but
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,6 +74,7 @@
 | 
			
		|||
static char *argv_start = NULL;
 | 
			
		||||
static size_t argv_env_len = 0;
 | 
			
		||||
static size_t argv_len = 0;
 | 
			
		||||
static char **argv1_addr = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* HAVE_SETPROCTITLE */
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +120,9 @@ compat_init_setproctitle(int argc, char *argv[])
 | 
			
		|||
			lastenvp = envp[i] + strlen(envp[i]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	argv[1] = NULL;
 | 
			
		||||
	/* We keep argv[1], argv[2], etc. at this moment,
 | 
			
		||||
	   because the ps command of AIX refers to them. */
 | 
			
		||||
	argv1_addr = &argv[1];
 | 
			
		||||
	argv_start = argv[0];
 | 
			
		||||
	argv_len = lastargv - argv[0];
 | 
			
		||||
	argv_env_len = lastenvp - argv[0];
 | 
			
		||||
| 
						 | 
				
			
			@ -162,6 +165,8 @@ setproctitle(const char *fmt, ...)
 | 
			
		|||
	argvlen = len > argv_len ? argv_env_len : argv_len;
 | 
			
		||||
	for(; len < argvlen; len++)
 | 
			
		||||
		argv_start[len] = SPT_PADCHAR;
 | 
			
		||||
	/* argv[1], argv[2], etc. are no longer valid. */
 | 
			
		||||
	*argv1_addr = NULL;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* SPT_NONE */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue