소스 검색

Fixed Directory Creation if Doesn't Exist

own3mall 7 년 전
부모
커밋
3ee94d85d7
1개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 3
      OGP/ogp_agent.pl

+ 9 - 3
OGP/ogp_agent.pl

@@ -1723,11 +1723,17 @@ sub check_b4_chdir
 	{
 		logger "$path does not exist yet. Trying to create it...";
 
-		if (!mkpath($path))
+		eval { mkpath($path); 1 } or logger "Error creating $path with Perl mkpath command. Errno: $! - Trying again with sudo...";
+
+		if (!-e $path)
 		{
-			logger "Error creating $path . Errno: $!";
-			return -1;
+			sudo_exec_without_decrypt('mkdir -p ' . $path);
 		}
+		
+		if (!-e $path)
+		{
+			return -1;
+		}		
 	}
 	
 	if (!chdir $path)