Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refuse to push server if it's a directory #956

Closed
rom1v opened this issue Nov 27, 2019 · 1 comment
Closed

Refuse to push server if it's a directory #956

rom1v opened this issue Nov 27, 2019 · 1 comment

Comments

@rom1v
Copy link
Collaborator

rom1v commented Nov 27, 2019

If SCRCPY_SERVER_PATH points to a directory, then adb push that_directory /data/local/tmp/scrcpy-server.jar will create a directory /data/local/tmp/scrcpy-server.jar/ on the device. In that case, app_process will just abort and fixing it requires a manual action from the user (adb shell rm -rf /data/local/tmp/scrcpy-server.jar).

To avoid the issue, we should check that the server path is not a directory before pushing it: https://github.com/Genymobile/scrcpy/blob/v1.10/app/src/server.c#L70

Random stackoverflow threads:
https://stackoverflow.com/questions/4553012/checking-if-a-file-is-a-directory-or-just-a-file
https://stackoverflow.com/questions/6218325/how-do-you-check-if-a-directory-exists-on-windows-in-c

Ref #268 #953 #278 (comment)

rom1v added a commit that referenced this issue Dec 5, 2019
If SCRCPY_SERVER_PATH points to a directory, then a directory will be
pushed to /data/local/tmp/scrcpy-server.jar.

When executing it, app_process will just abort and leave the directory
on the device, causing scrcpy to always fail.

To avoid the problem, check that the server is a regular file before
pushing it.

Closes #956 <#956>
@rom1v
Copy link
Collaborator Author

rom1v commented Dec 5, 2019

Fixed by 64bcac9.

@rom1v rom1v closed this as completed Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant